I need to create full screen activity that works on API 14 (Android 4.0). I'm using this code:
protected void onCreate(Bundle savedInstanceState) {
//Remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
It's not working. I haven't seen any crashes.
Try this.
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
MainActivity.java
super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(0x10);
setContentView(R.layout.activity_main);
But I think that should work, and your version. If you swapped
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
and
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);