I’m trying to call getX() on a button, but eclipse is telling me there’s no such method for button objects. In fact, it’s telling me there’s no getX() for Views either, which baffles me because the API says there are.
Code:
public boolean onTouch(View arg0, MotionEvent arg1) {
int touchX = (int)arg1.getX();
int touchY = (int)arg1.getY();
int tI_1 = (int)I_1.getX();
switch(touchX){
case tI_1:
//do something
break;
}
return false;
}
getX() and getY() are available only from API level 11 onwards. Try changing the API level of your application, might work.