How To Disable Notification Bar For An Android Application?
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
Solution 1:
Set a theme on the Application in your XML:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Solution 2:
You could us a theme in your AndroidManifest.xml:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
This will hide the title bar
<activityandroid:name=".YourClassName"android:theme="@android:style/Theme.NoTitleBar"/>
Solution 3:
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
publicclassContentBrowserextendsActivity {
privateLinearLayout _progressBarLayout;
@OverridepublicvoidonCreate(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")
privatevoidinitialize(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(newWebChromeClient() {
publicvoidonProgressChanged(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(newbrowserClient());
if (url != null && !"".equals(url))
webView.loadUrl(url);
}
@OverridepublicvoidonBackPressed() {
finish();
}
publicclassbrowserClientextendsWebViewClient
{
@OverridepublicvoidonPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stubsuper.onPageStarted(view, url, favicon);
}
@OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
view.loadUrl(url);
returntrue;
}
@OverridepublicvoidonPageFinished(WebView view, String url) {
// TODO Auto-generated method stubsuper.onPageFinished(view, url);
_progressBarLayout.setVisibility(View.GONE);
}
}
}
Post a Comment for "How To Disable Notification Bar For An Android Application?"