RSS Feed

Detecting Gestures In Android Studio

This is how to detect gestures. I cribbed the code from this very good article..
I have simply made it tidier so that I haven’t used an inner class and called it from elsewhere, that is the only value of the code below.

below save in

public class DrawPicture

                    public DrawPicture(Canvas canvas, MyView inView)

                                   // Note onTouchListner set for view
                                   // Note you need to pass the context

                                      inView.setOnTouchListener(new OnSwipeTouchListener(inView.getContext()));
                                       …. ect..


Now for the listener class itself.  I store this OnSwipeTouchListener.Java. You will find code in this link

I have just changed it slightly for my own needs. No need to rewrite something that works well.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: