0

please see my code

public boolean onTouchEvent(MotionEvent event) {
         Log.e("mainClass",""+ event.getY( ));
     manager.setNewX((int)event.getX());
     manager.setNewY((int)event.getY());
     log("action = "+event.getAction());
     manager.doTouchEvent(event.getAction());
     return false;

}

when i pressed on field - i see coordinates and action ( event.getAction()). I see what log returned me 0 (action.down). But when i leave my finger from screen i not see event.action_up. Can any one explain me why i can't get actio_up

p.s. doTouchEvent - function which used in other class. doTouchEvent(int event);

p.s2 hello everyone :) can't set this to first line

Peter
  • 2,480
  • 6
  • 39
  • 60

3 Answers3

1

Just return true. do not return false.

Royer
  • 172
  • 1
  • 6
0

After I insert return super.onTouchEvent(event); at the end of the method (onTouchEvent must return a value) your code works for me, when I put it in a blank main activity.

You should probably return true instead of breaking in those cases because you are responding to the event. Android ACTION_UP even never called

Community
  • 1
  • 1
tanshiwei
  • 169
  • 2
  • 4
0

If you define onTouchEvent() for your custom view try calling it for the super view.

return super.onTouchEvent(event);.
k_shil
  • 2,108
  • 1
  • 20
  • 25
  • not working (( after if - test's i see what only action_down work . Other action's not working :( – Peter Jul 07 '11 at 12:41
  • i fixed it.. can't understand but when using "if" - my code not work , but when im using switch - than all works perfectly . Thanks u code helped me too. – Peter Jul 14 '11 at 12:28