Full-screen Android activity

To view a full-screen Activity in Android I know two methods, the first by executing commands directly from code:

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class MyActivity extends Activity {
    @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.main_layout);
    }
}

The second by modifying the file AndroidManifest. xml:

<activity android:name=".MyActivity"
    android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity>

Leave a Comment

Your email address will not be published. Required fields are marked *