java.lang.RuntimeException:Unable to resume activity {com.xx.yy/com.xx.yy.activity.SomeActivity}: java.lang.IllegalStateException: No activity
2 android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103)
3 ......
4 Caused by:
5 java.lang.IllegalStateException:No activity
6 android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1812)
7 android.support.v4.app.FragmentManagerImpl.dispatchStateChange(SourceFile:3244)
8 android.support.v4.app.FragmentManagerImpl.dispatchResume(SourceFile:3212)
9 android.support.v4.app.FragmentController.dispatchResume(SourceFile:217)
10 android.support.v4.app.FragmentActivity.onResumeFragments(SourceFile:509)
11 android.support.v4.app.FragmentActivity.onPostResume(SourceFile:498)
12 android.support.v7.app.AppCompatActivity.onPostResume(SourceFile:171)
13 android.app.Activity.performResume(Activity.java:6385)
14 android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
15 android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
16 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
17 android.app.ActivityThread.access$900(ActivityThread.java:150)
18 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
19 android.os.Handler.dispatchMessage(Handler.java:102)
20 android.os.Looper.loop(Looper.java:148)
21 android.app.ActivityThread.main(ActivityThread.java:5417)
22 java.lang.reflect.Method.invoke(Native Method)
23 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
24 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
原因: 在onResume中或者onCreate中直接调用
onDestroy
导致的。
我们可以直接调用finish,但不能直接调用onDestroy, 这个是系统通过ActivityThread调用,我们不要主动调用它