1

I need to show and hide the system bar in my application, hence I used two buttons for that. I used to test for both Android (3.0.1) and Android (4.1.1) devices. For Android (3.0.1), I am able to hide and show the system bar as per my requirement. But in Android (4.1.1), buttons are not working to hide and show the system bar.

and my code is

// Showing system bar
    showSystemBarBtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
                proc.waitFor();
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    });

    // Hiding System bar
    hideSystemBarBtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});
                proc.waitFor();
            } catch(Exception e){
                e.printStackTrace();
            }
        }
    });

How can I solve the issue?

halfer
  • 19,824
  • 17
  • 99
  • 186
kumar Sudheer
  • 705
  • 3
  • 8
  • 28

1 Answers1

0

For hiding :

Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});

" Try to change the "79" to "42".

The process id for the SystemUI class changed from 79 to 42 when ICS was introduced.

gger
  • 33
  • 1
  • 4