Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

PopToRootAsync in OnResume

$
0
0

Hello,

i would like to navigate to my root page when the app resumes.

On iOS i can use this in my App.cs:

protected override async void OnResume()
{
    await App.Current.MainPage.Navigation.PopToRootAsync ();
}

On Android (with AppCompat) this results in an error message:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.n_onStop(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.onStop(FormsAppCompatActivity.java:110)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1212)
at android.app.Activity.performStop(Activity.java:5376)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3185)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234)
at android.app.ActivityThread.access$1100(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

What can i do to make this work?

Regards,
Dirk


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>