Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

android - Activity did not call finish? (API 23)

I am getting the following error and i have no clue as to why its happening.

Error:

08-23 17:07:46.533  22454-22454/com.a.b.c E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.a.b.c, PID: 22454
    java.lang.RuntimeException: Unable to resume activity {com.a.b.c/com.a.b.c.MainActivity}: java.lang.IllegalStateException: Activity {com.a.b.c/com.a.b.c.MainActivity} did not call finish() prior to onResume() completing
            at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103)
            at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.IllegalStateException: Activity {com.a.b.c/com.a.b.c.MainActivity} did not call finish() prior to onResume() completing
            at android.app.Activity.performResume(Activity.java:6324)
            at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
????????????at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
????????????at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
????????????at android.app.ActivityThread.-wrap11(ActivityThread.java)
????????????at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
????????????at android.os.Handler.dispatchMessage(Handler.java:102)
????????????at android.os.Looper.loop(Looper.java:148)
????????????at android.app.ActivityThread.main(ActivityThread.java:5417)
????????????at java.lang.reflect.Method.invoke(Native Method)
????????????at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
????????????at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Code:

protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
    System.out.println("Started");
}

I am trying to run the code on an AVD running android 6.0 (API 23), works on API 22.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm having the same problem, the same crash with the

did not call finish() prior to onResume() completing

error message. So I created the v23styles.xml

<style name="AppTheme" parent="android:Theme.Translucent">
...
</style>

while the normal styles.xml has

<style name="AppTheme" parent="android:Theme.NoDisplay">
...
</style>

It works fine, no longer crashes. However, I don't know how good is this solution, to use Theme.Translucent in API 23, especially as it is defined as

Theme for translucent activities (on API level 10 and lower).

I really hope they fix this bug.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...