Android Question Simulate click on hide navigation bar icon

rworner

Member
Licensed User
Longtime User
I am using a webview to display operational data on an overhead screen using series MK802IIIS/MK802IV devices. I want to hide the navigation bar from view. Originally I used ICSControls which worked on the early device releases. Now they have a later firmware version and no longer respond to the ICSControls commands. The navigation bar appears at the bottom of the screen with the icon that hides it displayed to the right of the power off soft button. Is there a method to simulate clicking on the "hide navbar icon" so that the bottom bar is blank?
 

rworner

Member
Licensed User
Longtime User
I found this code snippet that will shut it off, but how would I migrate it to B4A?
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
 
Upvote 0

rworner

Member
Licensed User
Longtime User
I also found another way to accomplish it.


B4X:
'--- WARNING THIS TOTALLY DISABLES THE NAV BAR ---
'ONLY USE IF YOU NEVER WANT THE NAV BAR DISPLAYED!!!
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As String
Dim Ph As Phone
Runner = File.Combine(File.DirInternalCache, "runner")
Command = File.Combine(File.DirInternalCache, "command")
File.WriteString(File.DirInternalCache, "runner", "su < " & Command)
File.WriteString(File.DirInternalCache, "command",  "service call activity 42 _
s16 com.android.systemui"  & CRLF & "exit")
Result = Ph.Shell("sh", Array As String(Runner), StdOut, StdErr)
 
Last edited:
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I also found another way to accomplish it.


B4X:
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As String
Dim Ph As Phone
Runner = File.Combine(File.DirInternalCache, "runner")
Command = File.Combine(File.DirInternalCache, "command")
File.WriteString(File.DirInternalCache, "runner", "su < " & Command)
File.WriteString(File.DirInternalCache, "command",  "service call activity 42 _
s16 com.android.systemui"  & CRLF & "exit")
Result = Ph.Shell("sh", Array As String(Runner), StdOut, StdErr)
You should really put big warnings around your code or beginners will take it and run it without even trying to understand what it really does. Your code disables completely the system UI on a rooted device (and that's why it's a lame solution to my eyes). If the program crashes and cannot restore the former situation by restarting the service, the user is in a big trouble (it's one of the perfect ways to get a lot of one-star on Google Play).
 
Last edited:
Upvote 0

rworner

Member
Licensed User
Longtime User
You should really put big warnings around your code or beginners will take it and run it without even trying to understand what it really does. Your code disables completely the system UI on a rooted device (and that's why it's a lame solution to my eyes). If the program crashes and cannot restore the former situation by restarting the service, the user is in a big trouble (it's one of the perfect ways to get a lot of one-star on Google Play).
Thanks. I should have considered that. The code above has been modified. I am using this on a MK802 device that plugs into a monitor for use as a kiosk mounted on a wall. There is no user interaction and the kiosk looks better without the NAV BAR. I am still looking of other ways to accomplish the task, but it appears that this device does not always work the way a tablet or phone would.
 
Upvote 0
Top