Question

I wanted to implement in my application the fullscreen. I found this code to do it:

public class FullScreen 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);
}
}

or through the AndroidManifest.xml

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

well none goes. Both makes my app crash when I launch it. The error is "Unfortunately application has stopped". Anyone knows the problem?

Was it helpful?

Solution

Try this code to make your activity FULL_SCREEN

  1. Looking for find: styles.xml in res\values\ add

    <style name="NoTitle" parent="AppBaseTheme">
        <item name="android:windowNoTitle">true</item>
    </style>    
    

  2. Open file Manifest Looking for application

Add

android:theme="@style/NoTitle">

It looks like:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/NoTitle" >

OTHER TIPS

put your code BEFORE super.onCreate(savedInstanceState)

This worked for me.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top