The Aim was to make a single activity full screen. for this, on the specific activity, done the below programmatically.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_clock);
09-26 11:57:38.370 14828-14828/livingmobile.com.eyeome E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: livingmobile.com.eyeome, PID: 14828
java.lang.RuntimeException: Unable to start activity ComponentInfo{livingmobile.com.eyeome/livingmobile.com.eyeome.ClockActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:302)
Some of the options mentioned were to call the requestFeature before the super.onCreate method.
This intact worked.
Other options mentioned where to set the theme as
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"
android:name="livingmobile.com.eyeome.ClockActivity"
android:label="@string/title_activity_clock"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
However, if the total application theme is
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:113)
at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at livingmobile.com.eyeome.ClockActivity.onCreate(ClockActivity.java:34)
We can specify the app theme to be AppCombat as specified in one of the below links.
References:
No comments:
Post a Comment