i changed it to true but it doesn't seem to have any effect. everytime only MotionEvent.ACTION_MOVE fired twice and left , right logic doesn't work properly.
i am following this link http://osdir.com/ml/AndroidDevelopers/2009-01/msg00639.html On Jul 7, 11:27 am, Suhas <[email protected]> wrote: > Hi > I think u should return true and not false in ontouchevent > > > > On Tue, Jul 7, 2009 at 3:51 PM, zeeshan <[email protected]> wrote: > > > Hi dear, > > > i need left, right motion event and a click event . > > problem is that, if i have onclickEvent then onTouchEvent doesn't > > fire. > > onTouchEvent works only if i disable onclickEvent and also it doesn't > > work what i expect. > > > 1-only ACTION_MOVE fires twice everytime when i move on screen. > > 2-can't get left and right motion > > > please figure what is wrong in the code below: > > > @Override > > public boolean onTouchEvent(MotionEvent event) { > > > switch (event.getAction()) { > > case MotionEvent.ACTION_DOWN: > > startX = (int)event.getX(); > > startY = (int)event.getY(); > > return true; > > case MotionEvent.ACTION_MOVE: > > endX = (int)event.getX(); > > endY = (int)event.getY(); > > if((endX - startX) > 0) { > > //right > > } > > if((endX - startX) < 0) { > > //left > > } > > startX = (int)event.getX(); > > startY = (int)event.getY(); > > > return true; > > case MotionEvent.ACTION_UP: > > endX = (int)event.getX(); > > endY = (int)event.getY(); > > return true; > > } > > return false; > > } > > > thanks in advance > > -- > Regards, > Suhas Gavas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

