我对这段代码有问题。它总是继续“你在博物馆外面或再次检查你的位置”祝酒:/你认为问题是什么?这是代码:
x3 = x3 * -1; //for example is 187
y3 = y3 * -1;//for example is 698
ImageView img = (ImageView) findViewById(R.id.imageView1);
if(((x3 <= 150) && (x3 >= 170)) && ((y3 <= 680) && (y3 >= 725))){
img.setImageResource(R.drawable.map_1_full_lite);
Toast.makeText(getBaseContext(), "You're currently on Section 1", Toast.LENGTH_LONG).show();
currentSection = "sect_1";
}else if(((x3 <= 170) && (x3 >= 195)) && ((y3 <= 690) && (y3 >= 715))){
img.setImageResource(R.drawable.map_2_full_lite);
Toast.makeText(getBaseContext(), "You're currently on Section 2", Toast.LENGTH_LONG).show(); //this suppost to be the output
currentSection = "sect_2";
}else if(((x3 <= 200) && (x3 >= 230)) && ((y3 <= 680) && (y3 >= 720))){
img.setImageResource(R.drawable.map_3_full_lite);
Toast.makeText(getBaseContext(), "You're currently on Section 3", Toast.LENGTH_LONG).show();
currentSection = "sect_3";
}else if(((x3 <= 190) && (x3 >= 220)) && ((y3 <= 675) && (y3 >= 710))){
img.setImageResource(R.drawable.map_4_full_lite);
Toast.makeText(getBaseContext(), "You're currently on Section 4", Toast.LENGTH_LONG).show();
currentSection = "sect_4";
}else if(((x3 <= 175) && (x3 >= 219)) && ((y3 <= 710) && (y3 >= 745))){
img.setImageResource(R.drawable.map_5_full_lite);
Toast.makeText(getBaseContext(), "You're currently on Section 5", Toast.LENGTH_LONG).show();
currentSection = "sect_5";
}else if(((x3 <= 155) && (x3 >= 165)) && ((y3 <= 715) && (y3 >= 735))){
img.setImageResource(R.drawable.map_6_full_lite);
Toast.makeText(getBaseContext(), "You're currently on Section 6", Toast.LENGTH_LONG).show();
currentSection = "sect_6";
}else{
Toast.makeText(getBaseContext(), "You're outside of the museum or Check your postion again", Toast.LENGTH_LONG).show();
}