1

I have an android application which lists installed applications and launch them on item click.I want to disable accessing NotificationBar from my application.ie,When user launch 'Browser' application from my application,it is possible to drag down the notification bar and he/she can change settings of gps,wifi etc...I tried this

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

But it works only for my activity.How to disable Notification Bar for my whole application?

Thanks in Advance

Devu Soman
  • 2,246
  • 13
  • 36
  • 57
  • Neil,That answers does not work for me.Because of this I posted again. – Devu Soman Apr 02 '13 at 10:22
  • you can use web view and launch the URL within you application rather then launching the browser application... I dont think that you can disable notification bar when your app is not getting used.. – Praful Bhatnagar Apr 02 '13 at 10:26
  • 3
    The Browser is an external application. We cannot control or change the view/window of others application. The things you want is not possible. Those application are not going to use your theme or settings even if that application is run from your app. – Vivek Khandelwal Apr 02 '13 at 10:26

3 Answers3

1

You could us a theme in your AndroidManifest.xml:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

This will hide the title bar

<activity android:name=".YourClassName"
android:theme="@android:style/Theme.NoTitleBar"/>
Linga
  • 10,379
  • 10
  • 52
  • 104
  • I tried this.but This works well for activities of my application.But does not work for Brower like applications – Devu Soman Apr 02 '13 at 10:20
  • Try this: getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); – Linga Apr 02 '13 at 10:28
  • Ling,It worked for my activities. While I am launching Browser,Contacts etc... from my application shows Notification bar and possible to access it. I want to disable Notification bar throughout my application. – Devu Soman Apr 02 '13 at 10:30
  • +1, I've found no way. If you find an answer please update it – Linga Apr 02 '13 at 10:31
1

Set a theme on the Application in your XML:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Kitesurfer
  • 3,438
  • 2
  • 29
  • 47
0

See my code below. I applied the code you specified in your question and my notification bar is hidden. You won't be able to disable the notification bar for external browser applications

public class ContentBrowser extends Activity {
    private LinearLayout _progressBarLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.browserlayout);

        Bundle receiveBundle = this.getIntent().getExtras();

        initialize(receiveBundle.getString("url"));
    }

    @SuppressLint("SetJavaScriptEnabled")
    private void initialize(String url) {

        WebView webView = (WebView) findViewById(R.id.browserView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
        webView.getSettings().setDomStorageEnabled(true);

        _progressBarLayout = (LinearLayout) findViewById(R.id.browserProgressLayout);

        final Activity activity = this;
        webView.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                // Activities and WebViews measure progress with different scales.
                // The progress meter will automatically disappear when we reach 100%
                activity.setProgress(progress * 1000);
            }
        });

        webView.setWebViewClient(new browserClient());

        if (url != null && !"".equals(url))
            webView.loadUrl(url);
    }

    @Override
    public void onBackPressed() {
        finish();
    }

    public class browserClient extends WebViewClient
    {
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            // TODO Auto-generated method stub
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // TODO Auto-generated method stub

            view.loadUrl(url);
            return true;

        }

        @Override
        public void onPageFinished(WebView view, String url) {
            // TODO Auto-generated method stub
            super.onPageFinished(view, url);

            _progressBarLayout.setVisibility(View.GONE);
        }
    }

}
the-ginger-geek
  • 7,041
  • 4
  • 27
  • 45