motionevent - Android Motion Event -


i trying android motion event. however, not know why cant go > case motionevent.action_move:

here codes.

@override public boolean ontouch(view v, motionevent event) {      int action = event.getaction();     switch (action){         case motionevent.action_down:              startx = (int)event.getx();             starty = (int)event.gety();             selecting=false;             break;         case motionevent.action_move:             selecting=true;             break;         case motionevent.action_up:             if(selecting){                 endx = (int)event.getx();                 endy = (int)event.gety();                 selected=true;             }             selecting=false;             break;      } } 

no matter how swipe , touch, if remove if(selecting) condition in case motionevent.action_up, show same output.

start: {498.0, 365.0}
end: {0.0, 0.0}
selecting: false
selected: false

after change

public boolean ontouchevent(motionevent event)

everything okay. can explain me why happen?

if possible, me solve problem too. how actual point when touch on screen?

in order following motionevents, must return true in ontouchevent method.

source


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -