ShineDown
ShineDown

Reputation: 1879

android touch tracking

I have a Main activiy, and many other activity that extends main activity. I want to track all touch events like clicking button, listview item, textView..etc in child activities .But i was unable to do that.I Implemented onTouchEvent(MotionEvent event) in main activity,

@Override
onTouchEvent(MotionEvent event)
     public boolean onTouchEvent(MotionEvent event) {
            System.out.println("onTouchEvent pressed");
            return super.onTouchEvent(event);
        }

But This function was not called.. any ideas?

Upvotes: 1

Views: 2316

Answers (1)

pellucide
pellucide

Reputation: 3627

Take a look at https://github.com/commonsguy/cw-advandroid/blob/master/Tapjacking/Jackalope/src/com/commonsware/android/tj/jackalope/Tapjacker.java.

It is a service that adds a transparent View to the window manager. The service also implements a onTouchListener. The listener will track all touch events while the app is running.

It is probably the easiest to implement and provides a central place to track touch events.

Upvotes: 1

Related Questions