EF's Blog

Android Tutorial : Show Status Bar Programmatically

Posted on: April 11, 2012

create new class

public class basicdisplayoption {
public static void toggleStatusBar(Activity myActivityReference, boolean boolYesNo) {
if(boolYesNo == true)
{
WindowManager.LayoutParams attrs = myActivityReference.getWindow().getAttributes();
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
myActivityReference.getWindow().setAttributes(attrs);
}
else
{
WindowManager.LayoutParams attrs = myActivityReference.getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
myActivityReference.getWindow().setAttributes(attrs);
}
}
}

and
at activity onCreate, to turn on status bar, call
basicdisplayoption.toggleStatusBar(sinarmasmsiglife.this, true);
to turn off :
basicdisplayoption.toggleStatusBar(sinarmasmsiglife.this, false);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

EF’s Blog

I'm just ordinary people who lived in an extra-ordinary world.

EF's Blog Stats

  • 126,562 hits
April 2012
M T W T F S S
« Oct   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Archives

%d bloggers like this: