ANDROID: How to have a canvas the responds to a user touch -


i'm new canvas , animations, wondering coding user touches be! in example saw this,

switch (event.getaction()) { case motionevent.action_down:     drawpath.moveto(touchx, touchy);     break; case motionevent.action_up:     drawcanvas.drawpath(drawpath, drawpaint);     drawpath.reset();     break; default:     return false; 

i'm not sure how works. if app wanting create responds move ball responding when user tapped, how should this? (think flappy bird screen moves up)

in motionevent.action_down:, can't use canvas.getwidth() or parameters see user touched.

thanks , :)

to user touched you'd use event.getx() , event.gety(). wouldn't use canvas operations @ all.


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -