Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: show/hide status bar/power bar
    primarykey
    data
    text
    <p>I am trying to create a button where I can hide or show the status bar on my tablet.</p> <p>I've put in the onCreate</p> <pre><code>getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); </code></pre> <p>and in the buttons show: </p> <pre><code>WindowManager.LayoutParams attrs = getWindow().getAttributes(); attrs.flags &amp;= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; getWindow().setAttributes(attrs); </code></pre> <p>hide:</p> <pre><code>WindowManager.LayoutParams attrs = getWindow().getAttributes(); attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; getWindow().setAttributes(attrs); </code></pre> <p>Any hints/tipps?</p> <p>//edit</p> <p>I've looked at this hint here: <a href="http://android.serverbox.ch/?p=306" rel="noreferrer">http://android.serverbox.ch/?p=306</a> and changed my code like this:</p> <pre><code>private void hideStatusBar() throws IOException, InterruptedException { Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"}); proc.waitFor(); } private void showStatusBar() throws IOException, InterruptedException { Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"}); proc.waitFor(); } </code></pre> <p>So if I click on my buttons an the methods are called I can see that something is happening because the app is waiting some seconds. I also looked into LockCat and see that something is happening.</p> <p>show: <a href="http://pastebin.com/CidTRSTi" rel="noreferrer">http://pastebin.com/CidTRSTi</a> hide: <a href="http://pastebin.com/iPS6Kgbp" rel="noreferrer">http://pastebin.com/iPS6Kgbp</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload