Can anyone explain to me why is the onTouchEvent
executed twice and how can I set it to run only once? I couldn't find an explanation. Thanks.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
_iv = new ImageView(this);
_map = BitmapFactory.decodeResource(getResources(), R.drawable.image);
_iv.setImageBitmap(_map);
_iv.invalidate();
setContentView(_iv);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
double X = event.getX();
double Y = event.getY();
Toast.makeText(this, "X: " + X + " Y: " + Y, Toast.LENGTH_SHORT).show();
return super.onTouchEvent(event);
}