0

I want to detect the action based on the status bar. In fact I want to limit the right of this section. i tried

mGrid.setOnTouchListener(new OnTouchListener(){
               public boolean onTouch(View arg0, MotionEvent arg1){
                    int x = (int) arg1.getX();
                    int y = (int) arg1.getY();
                    Log.d("Screen", String.valueOf(x));
                    Log.d("Screen", String.valueOf(y));
                    switch(arg1.getAction()){
                    case MotionEvent.ACTION_OUTSIDE:
                        Log.d("tototootot", "acces dinied");
                    //case MotionEvent.


                    }


                    return true;
               } 
diez
  • 125
  • 1
  • 5
  • 12

1 Answers1

0

You cannot really detect touches and events on the notification bar.

You can however block all touches from reaching it entirely by drawing over the notification bar with a system overlay that doesn't let touch events filter through. This SO question shows how to draw an overlay. Make sure to remove it once you are done with your app, as it will persist regardless of which app is in the foreground.

Community
  • 1
  • 1
Raghav Sood
  • 81,899
  • 22
  • 187
  • 195