现在的位置: 首页 > 综合 > 正文

ERROR/AndroidRuntime(680): android.app.SuperNotCalledException: Activity

2018年01月31日 ⁄ 综合 ⁄ 共 2201字 ⁄ 字号 评论关闭
 
07-25 14:26:11.293: ERROR/AndroidRuntime(680): FATAL EXCEPTION: main
07-25 14:26:11.293: ERROR/AndroidRuntime(680): android.app.SuperNotCalledException: Activity {com.paul.android.recyle/com.paul.android.recyle.Build} did not call through to super.onStart()
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.app.Activity.performStart(Activity.java:3793)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1595)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.os.Looper.loop(Looper.java:123)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at android.app.ActivityThread.main(ActivityThread.java:3647)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at java.lang.reflect.Method.invokeNative(Native Method)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at java.lang.reflect.Method.invoke(Method.java:507)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-25 14:26:11.293: ERROR/AndroidRuntime(680):     at dalvik.system.NativeStart.main(Native Method)

 

 

怪怪的,难道重父类的方法还要调用父类的被重写的方法?

 

不报错

protected void onRestart() {
		super.onRestart();
		System.out.println("Build"+"====>"+"onRestart");
	}

报错

protected void onRestart() {
	System.out.println("Build"+"====>"+"onRestart");
	}

 然后看了下Android 的文档

The entire lifecycle of an activity is defined by the following Activity methods. All of these are hooks that you can override to do appropriate work when the activity changes state. All activities will implement onCreate(Bundle) to do their initial setup; many will also implement onPause() to commit changes to data and otherwise prepare to stop interacting with the user. You should always call up to your superclass when implementing these methods.

 

明了...

抱歉!评论已关闭.