Oreo中AppcompactActivity的onCreate()方法的IllegalstateException

时间:2018-04-28 06:50:57

标签: java android receiver

我正在使用@ style / Theme.AppCompat.Light.Dialog.NoActionBar主题来显示Dialog Activity.It在Oreo下工作得很好但是在oreo中崩溃了:

public class AdvancePaintActivity extends AppCompatActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_paint_advance); 
    }

java.lang.RuntimeException: 
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3194)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3302)
at android.app.ActivityThread.-wrap12 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1891)
at android.os.Handler.dispatchMessage (Handler.java:108)
at android.os.Looper.loop (Looper.java:166)
at android.app.ActivityThread.main (ActivityThread.java:7425)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
Caused by: java.lang.IllegalStateException: 
at android.app.Activity.onCreate (Activity.java:1081)
at android.support.v4.app.SupportActivity.onCreate (SupportActivity.java:66)
at android.support.v4.app.FragmentActivity.onCreate (FragmentActivity.java:321)
at android.support.v7.app.AppCompatActivity.onCreate (AppCompatActivity.java:84)
at com.coloringdrawing.mandala.coloringpage.controller.paint.AdvancePaintActivity.onCreate (AdvancePaintActivity.java:70)
at android.app.Activity.performCreate (Activity.java:7372)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1218)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3147)

0 个答案:

没有答案