因此,我试图在用户输入给定的 GPS 位置后让 imageview 更改其图像,但是一旦我到达该位置,我的应用程序就会一直关闭,我可以让 TextView 更改更改其文本,所以我认为它会是图像有点相同,但显然不是 LOL。
我把这个放在我的public class activity: ImageView sprite;
我刚有这个setContentView: sprite = (ImageView)findViewById(R.id.imageView1);
我对每个位置都使用“IF”语句,如下所示:
if(pLat >= homeLat - 0.0001000 && pLat <= homeLat + 0.0001000
&& pLong >= homeLong - 000.0002000 && pLong <= homeLong + 000.0002000)
{
gateway.setText(R.string.home);
gatewayDis.setText(R.string.homeD);
sprite.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.minimap));
// the image change is the only part that isn't working
}
任何帮助将不胜感激,谢谢。