I am new to Android development.
How to write onTouchEvent() in one activity and access in all other activities in the application?
I am trying in following way:
Public class TouchActivity extends Activity
{
    @Override
    public boolean onTouchEvent(MotionEvent event){
        int action = MotionEventCompat.getActionMasked(event);
        boolean touch_up_detect;
        if (action == MotionEvent.ACTION_UP)
        {
            //touch_up_detect = true;
            if (timer == null)
            {
                timer = new Timer();
                timer.schedule(new ScheduledTaskWithHandeler(), 10000);
            }               
        }
        else if (action == MotionEvent.ACTION_DOWN)
        {
            System.out.println("user touching screen**********");
            if (timer != null)
            {
                timer.cancel();
                timer.purge();
            }                 
        }
        return false;           
    }
    class ScheduledTaskWithHandeler extends TimerTask {
        @Override
        public void run() {
            // TODO Auto-generated method stub
            Intent intent = new Intent(TouchActivty.this, MainActivity.class);
            startActivity(intent);
        }   
    }
}
public class DashboardActivity extends TouchActivity
{
}
Whenever I am touching the dashboard activity, I am not able to access onTouchEvent() from TouchActivity.
 
     
     
    