Android : Full Screen Activity

In some applications it may be required to show the activity on full screen. One of the advantages is to utilize the full real estate on the screen. The activity will be fill the whole screen without showing the activity title and the phone notification area.

There are two ways to do this in the android. Depending on specific requirements the approach can be decided.

From the configuration

This is obvious approach where the setting can be done in the AndroidManifest.xml of the project. Below is the configuration.

<application android:icon="@drawable/icon" android:label="@string/app_name">
	<activity android:name=".Activity1"
	<activity android:name=".Activity2"

This is standard setting of the activity in AndroidManifest.xml. Note the lines #5 and #9 in the above code snippet. By adding this theme the activity will be displayed full screen. This line needs to be added to all those activities which needs to be displayed as full screen.

Programmatic Approach

This is another way to achieve the same from the code. Add following code in the activity’s onCreate(Bundle savedInstanceState) method.

public void onCreate(Bundle savedInstanceState) {
        // remove title

Note requestWindowFeature(Window.FEATURE_NO_TITLE) is called before setting the flags for windows. Also these calls should be done before setting the content view i.e. setContentView(R.layout.main) here. Using programmatic approach allows developer to optionally set the full screen mode by checking some condition if needed.

Several other Window features can be controlled using this technique. List of window features can be seen here.


Posted on March 27, 2012, in Android and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: