Android: OnTouch, MotionEvent.ACTION_MOVE no se reconoce?
Aquí está mi código, quiero detectar cuando mi dedo baja la pantalla y cuando toco la pantalla detectoACTION_DOWN
pero cuando voy por la pantalla con mi dedo,ACTION_MOVE
no es reconocido, tampocoACTION_UP
¿Sabes por qué?
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
}
}
}
}