Environment
- CLI: 5.1.0
- Cross-platform modules: 5.1.0
- Android Runtime: 5.1.0
Describe the bug
Navigating to a page when app resumes from background causes the app to crash with the following exception:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to resume activity {org.nativescript.bl32/com.tns.NativeScriptActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
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)
To Reproduce
- Create app from blank template
- Add new Page second-page.xml
- Add the following application.resumeEvent handler to app.ts:
import * as application from "tns-core-modules/application";
import { topmost } from "tns-core-modules/ui/frame";
application.on(application.resumeEvent, (context) => {
topmost().navigate("home/second-page");
});
application.run({ moduleName: "app-root" });
- Start app
- Suspend app
- Resume app -- app crashes
Originally reported by @nudiref here: #6201
Environment
Describe the bug
Navigating to a page when app resumes from background causes the app to crash with the following exception:
To Reproduce
Originally reported by @nudiref here: #6201