在Android的&QUOT错误; SuperNotCalledException:活动没有要求通过对super.OnCreate()" [英] Error in Android "SuperNotCalledException:Activity did not call through to super.OnCreate()"

查看:166
本文介绍了在Android的&QUOT错误; SuperNotCalledException:活动没有要求通过对super.OnCreate()"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

未捕获的处理程序:螺纹主力退出,由于未捕获的异常 android.app.SuperNotCalledException:活动没有要求通过对super.OnCreate()

我的code是:

 公共无效的onCreate(包savedInstanceState){
        布尔的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);

                //邮政意图重新加载
                意向意图=新的意图(Intent.ACTION_AIRPLANE_MODE_CHANGED);
                //intent.putExtra("state,!的IsEnabled); //呼吁
                尝试 {
                    视频下载(15000);
                }赶上(InterruptedException异常E){
                    // TODO自动生成的catch块
                    e.printStackTrace();
                }
                intent.putExtra(状态,IsEnabled的);
                                                                                           this.getApplicationContext()sendBroadcast(意向)。


}
 

解决方案

添加 super.onCreate(savedInstanceState);

 公共无效的onCreate(包savedInstanceState){
  super.onCreate(savedInstanceState);
        布尔的IsEnabled = Settings.System.getInt(this.getApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0)== 1;
...
...
...
 

uncaught handler:thread main exiting due to uncaught exception android.app.SuperNotCalledException:Activity did not call through to super.OnCreate()

My Code is:

  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);


}

解决方案

Add 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的&QUOT错误; SuperNotCalledException:活动没有要求通过对super.OnCreate()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆