1

I am developing an application which should have some extra security features. In this case I have to disable/hide the status bar. I am running with Android 2.2.

And also my device is rooted and if there is an ADB command to disable status bar, it would be fine as well.

For now what I do is basically when user try to expand the status bar I collapse it by invoking some . But sometimes user can expand it and click on the items in status bar notifications.

This code part will do this,

 public void onWindowFocusChanged(boolean hasFocus)
 {
         try
         {
            if(!hasFocus)
            {
                 Object service  = getSystemService("statusbar");
                 Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
                 Method collapse = statusbarManager.getMethod("collapse");
                 collapse .setAccessible(true);
                 collapse .invoke(service); 
            }
         }
         catch(Exception ex)
         {

         }
 }

And also I tried setting application as full screen app. But it also has some problems.

Can someone please help me to solve this issue?

Can someone please help me to do this?

Bob
  • 22,810
  • 38
  • 143
  • 225
bimal
  • 41
  • 1
  • 2
  • 7
  • What you are trying to do will cause the notification panel (the thing that pulls down from the status bar) to go back up, if it was pulled down. You CANNOT hide the status bar in this manner. – Tom Jul 09 '12 at 03:54

1 Answers1

4

you can select the theme spinner and select the "Theme.NoTitleBar.Fullscreen".

Using code:-

requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

above written code placed in oncreate method

Amit kumar
  • 1,585
  • 2
  • 16
  • 27
  • I am using this code part to disable the home button . @Override public void onAttachedToWindow() { getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } So adding your code part won't help me since it is getting reset when phone gets a call or go to another application and come back. Thank you for the reply . – bimal Jun 08 '12 at 07:25