Hide Tablet system bar
Asked Answered
E

11

14

I want to hide system bar for tablet device. I searched a lot but not succeed. I added image for it.

I found some solution like

View v = findViewById(R.id.view_id);
v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN); 

but I dont know how to use it enter image description here

And I know that is possible as http://forum.xda-developers.com/showthread.php?t=1228046 Can any one know how to do this ?

Elephus answered 14/8, 2012 at 17:57 Comment(4)
"And I know that is possible" -- this requires root.Bray
What that app could do with root access it to kill the com.android.systemui process - not very elegant but that hides / kills the bar.Arsis
Kill and never start it - like you said, sloppy unfortunately. Did you ever figure out an elegant way to do this? (And / or tested sureLock?)Earth
@Nate I post an answer. Please see. hope you also short out your problem ...Elephus
E
4

Finally after searching lots of time I got some alternativ for my requirement.

I know this is not a good idea for a programmer to back off from this situation but for my time limit I used this way...

I found this link and application which fullfil my requirement

http://www.42gears.com/blog/2012/04/how-to-hide-bottom-bar-in-rooted-android-3-0-tablets-using-surelock/

please visit this once if you want this type of requirement in your application ....

Thanks to all for helping me in my problem...

Elephus answered 8/9, 2012 at 4:53 Comment(1)
@chirag-saga Isn`t SureLock a paid app? I think a good alternative is HideBar - github.com/ppareit/HideBar (It also requires root as well as BusyBox)Blanka
D
7

Code snippet to show/hide status bar on rooted android tablets

To hide:


            Process proc = null;

            String ProcID = "79"; //HONEYCOMB AND OLDER

            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
                ProcID = "42"; //ICS AND NEWER
            }

            try {
                proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "service call activity "+ProcID+" s16 com.android.systemui" });
            } catch (Exception e) {
                Log.w("Main","Failed to kill task bar (1).");
                e.printStackTrace();
            }
            try {
                proc.waitFor();
            } catch (Exception e) {
                Log.w("Main","Failed to kill task bar (2).");
                e.printStackTrace();
            }

To show:


            Process proc = null;
            try {
                proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "am startservice -n com.android.systemui/.SystemUIService" });
            } catch (Exception e) {
                Log.w("Main","Failed to kill task bar (1).");
                e.printStackTrace();
            }
            try {
                proc.waitFor();
            } catch (Exception e) {
                Log.w("Main","Failed to kill task bar (2).");
                e.printStackTrace();
            }
Detrusion answered 21/4, 2014 at 6:47 Comment(3)
Using the command service call activity 42 s16 com.android.systemui via the adb shell, it works. When using the code you posted above it won't hide the bars. Do I need any additional setup/permissions for my app to execute this?Lunchroom
@taymless: Your device should be rooted and your app should have access to su permissions.Besides these, I did not have any other setting set to achieve the above.Detrusion
Thanks. Not sure if this a problem with my device, but it's not asking for the su permission. I used this method with the hide/show commands you posted instead, and it worked. stealthcopter.com/blog/2010/01/….Lunchroom
E
4

Finally after searching lots of time I got some alternativ for my requirement.

I know this is not a good idea for a programmer to back off from this situation but for my time limit I used this way...

I found this link and application which fullfil my requirement

http://www.42gears.com/blog/2012/04/how-to-hide-bottom-bar-in-rooted-android-3-0-tablets-using-surelock/

please visit this once if you want this type of requirement in your application ....

Thanks to all for helping me in my problem...

Elephus answered 8/9, 2012 at 4:53 Comment(1)
@chirag-saga Isn`t SureLock a paid app? I think a good alternative is HideBar - github.com/ppareit/HideBar (It also requires root as well as BusyBox)Blanka
S
2

It is not possible to hide the system bar. There is nothing in the API that allows for it. This is because the user always needs access to the home and back keys in case the app freezes or does something goofy where the user just needs to get out of the app. You can only hide the action bar.

Smoko answered 14/8, 2012 at 18:4 Comment(4)
Actually, there is a way to temporarily hide the system bar on tablets, at least on Jelly Bean, but the bar returns as soon as the user taps the screen.Bray
Ooops, sorry -- that's only for handsets. For some reason, I thought it worked on tablets as well. I was thinking of SYSTEM_UI_FLAG_HIDE_NAVIGATION. My apologies.Bray
AndiJay - That is the correct reason for normal consumer use. However there is a rising demand in the corporate world for using Android Tablets as mini Kiosks. Right now the only way to do that is by rooting the tablet. I would love to see Android add a "Kiosk" mode for this situation though. Anyway, your answer is correct but not for every situation. When a tablet is being used for a kiosk then the user should not have access to anything except the single app.Mcnary
Interesting point. I wonder if Google will ever official support a way to remove the system bar then. They could go the way of windows 8 where you have to do a swipe gesture from one of the edges of the screen.Smoko
I
1

There is a workaround to disable menu bar in all most all tablets without rooting. But this is bit tricky, but it works clean. Several well known apps in the market at the moment using this strategy to achieve this disable menu bar feature for their apps.

  • Grant admin privilege.
  • Set password & lock the device using device admin profile api
  • Then load what ever the UIs on top of the native lock screen. (Of course this will show background lock screen whenever a transition happens between activities. But if logic is organized well, then it will be smooth & less noticed by the user)
  • When need to enable back, reset password to "" using resetPassword("", 0) of device policy manager object.
Inge answered 10/7, 2013 at 12:53 Comment(0)
S
1
var width = innerWidth;

var height = innerHeight;

I think this code will help for you.its not hide the tablet bar but your application fit on any device you can use this (I used this code in javascript for cord ova mobile application)

Seventieth answered 11/11, 2015 at 8:4 Comment(1)
This does not answer the OP's question, as you yourself mention ("its not hide the system bar"). If you have annotations to a post, please post a comment. You can do so as soon as you have earned the privilege to post anywhereBerne
E
1

You just need combination of SYSTEM_UI_FLAG_IMMERSIVE_STICKY | SYSTEM_UI_FLAG_HIDE_NAVIGATION | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN. For example, if you use opengl and glSurfaceView is you surface:

glSurfaceView.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
                View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

Swipe at bottom to see the bottom bar, it will hide again after few seconds.

Estimable answered 2/1, 2016 at 5:34 Comment(0)
E
0

I believe its the same for all android devices.

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

I also found another solution but this of course is just a separate app called surelock.

http://onkarsingh.sys-con.com/node/2184158

EDIT:

The above code doesn't hide the Tablet Bar. I'll leave my answer up for those looking to hide the System Bar in another Android Device.

Earth answered 14/8, 2012 at 18:0 Comment(3)
Yes CommonsWare is right I tried also this not working for tablets.Elephus
what doesn't work? The code or SureLock? SureLock has two options - Hide Bottom Bar and Disable Bottom Bar. First option requires rooting. Second on works without rooting!!Elkin
My code example doesn't but SureLock says it does. Can't say I've used it though.Earth
J
0

You can't hide it but you can simply disable it, except home. Try this link. . Using SYSTEM_UI_FLAG_LOW_PROFILE you can dim your system bar and using onWindowFocusChanged() can take the focus and collapse it.

Jerrilyn answered 27/3, 2013 at 6:9 Comment(1)
and so you can give your app the HOME powaVange
V
0

I found a trick on a galaxy tab for use it as a kiosk according to the developer guide of Samsung

You can ask your app to be over the lock system and ask the return button to go back to a start activity/view of your app. I done this for a web View app

    @Override
    public void onBackPressed() {
        //here asking to go back to home page
        mWebView.loadUrl(mHomepageUrl);
    }

for asking to stay up from the lock system, on the onCreate method :

getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

and then when you click on the power button twice , you found back your application , and only the back button is active on the status bar

So the only way is to reboot the tablet (and so you can use the classic lock system with a code to open tablet)

Can be useful if the power button is not accible by visitor , or if your are the only one who have the unlock code

Vange answered 17/9, 2014 at 14:21 Comment(0)
L
-1

// Put code on onCreate method of your activity / fragment

@Override
        @SuppressLint("NewApi")
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            getSupportActionBar().hide();
            setContentView(R.layout.activity_main);

              getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
        }
Lamothe answered 28/11, 2014 at 12:1 Comment(0)
B
-1

In order to create a Kiosk app in android you need the following: - Override the onkeydown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(keyCode==KeyEvent.KEYCODE_BACK || keyCode==KeyEvent.KEYCODE_HOME){


        startActivity(new Intent(this,MainActivity.class));
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

Then make your activity a launcher activity in order to override the home button. (in the manifest)

<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

No need for weird locker apps that asks a million permissions. You don't have to root your phone.

Brandish answered 10/3, 2015 at 7:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.