Here is my code, I want to detect when my finger goes down the screen so when I touch the screen I detect the ACTION_DOWN
but when I go down the screen with my finger, ACTION_MOVE
is not recognized, neither ACTION_UP
Do you know why?
float x=0;
protected void onCreate(Bundle savedInstanceState) {
do things
ImageView image2 = (ImageView) findViewById(R.id.imageView3);
image2.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
if (arg1.getAction()==MotionEvent.ACTION_DOWN) {
x=arg1.getX();
}
else {
if (arg1.getAction()==MotionEvent.ACTION_MOVE){
if (arg1.getX()>x) {
do things
}
}
else {
if (arg1.getAction()==MotionEvent.ACTION_UP){
do things
}
}
}
}