gpt4 book ai didi

android - Android "SuperNotCalledException:Activity did not call through to super.OnCreate()"错误

转载 作者:可可西里 更新时间:2023-11-01 18:43:36 35 4
gpt4 key购买 nike

uncaught handler:thread main exiting due to uncaught exception android.app.SuperNotCalledException:Activity did not call through to 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);


}

最佳答案

添加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;
...
...
...

关于android - Android "SuperNotCalledException:Activity did not call through to super.OnCreate()"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3260576/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com