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?