Unable to remove Navigation Bar - Android Tablet: 4.2.2
Asked Answered
C

1

0

I'm attempting to remove the navigation bar programatically using the most commonly found method on the internet - however the navigation bar continues to appear.

I've debugged the method and it is not throwing an exception - so I'm really not sure why we can't seem to hide the Navigation Bar using the following code:

(any suggestions are greatly appreciated)

Source:

try
{
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 42 s16 com.android.systemui"}); 
proc.waitFor();
}
catch(Exception ex)
{
//Toast.makeText(getApplicationContext
Crosslegged answered 2/5, 2014 at 19:49 Comment(2)
This is undocumented code and an unsupported area. There is no guarantee this will ever work.Clinkstone
A little bird once told me if there's a will there's a way... I have full root access - there MUST be a way of disabling it somehow. : )Crosslegged
D
1

Try doing this, somewhere after you have set your content's view

To hide your navigation bar

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

To hide your keyboard

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);

For more on the navigation bar, since it is what your question explicitly asks for, take a look here: Hiding the Navigation Bar

Diplosis answered 2/5, 2014 at 19:53 Comment(1)
I need to permanantly hide the keyboard - this does not hide it for me at all P.S. The devices is rooted - so that is not a problem - however your solution does not seem to hide the navigation bar when I implement it between onCreate and setContentViewCrosslegged

© 2022 - 2024 — McMap. All rights reserved.