Android中的错误"SuperNotCalledException:Activity没有调用super.OnCreate()"

Dav*_*run 16 android

未捕获的处理程序:由于未捕获的异常,线程主要退出android.app.SuperNotCalledException:Activity没有调用super.OnCreate()

我的代码是:

  public void onCreate(Bundle savedInstanceState) {
        boolean isEnabled = Settings.System.getInt(this.getApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0) == 1;


                Settings.System.putInt(this.getApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1);

                // Post an intent to reload
                Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
                //intent.putExtra("state",! isEnabled);//Call ON
                try {
                    Thread.sleep(15000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                intent.putExtra("state", isEnabled);
                                                                                           this.getApplicationContext().sendBroadcast(intent);


}
Run Code Online (Sandbox Code Playgroud)

Jor*_*sys 30

super.onCreate(savedInstanceState);

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
        boolean isEnabled = Settings.System.getInt(this.getApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0) == 1;
...
...
...
Run Code Online (Sandbox Code Playgroud)


Rev*_*ppa 5

在相应活动的清单中添加以下代码

  android:screenOrientation="fullSensor"
Run Code Online (Sandbox Code Playgroud)

此问题发生在 8.0 版本的 Activity 全屏和对话框活动中