Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not navigate fragment in OnPermissionDenied callback #116

Closed
Den-Rimus opened this issue Mar 18, 2016 · 1 comment
Closed

Can not navigate fragment in OnPermissionDenied callback #116

Den-Rimus opened this issue Mar 18, 2016 · 1 comment

Comments

@Den-Rimus
Copy link

When user denies permission I'm trying to open another screen by replacing fragment.

And I get this:

03-18 17:47:58.587 E/AndroidRuntime: FATAL EXCEPTION: main
                                     Process: com.worldventures.dreamtrips.dev.dtl.stage.debug, PID: 27306
                                     java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=514, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.worldventures.dreamtrips.dev.dtl.stage.debug/com.worldventures.dreamtrips.modules.common.view.activity.MainActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
                                         at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
                                         at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
                                         at android.app.ActivityThread.-wrap16(ActivityThread.java)
                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
                                         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: Can not perform this action after onSaveInstanceState
                                         at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1509)
                                         at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1527)
                                         at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:650)
                                         at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:617)
                                         at com.worldventures.dreamtrips.core.navigation.router.FragmentCompass.action(FragmentCompass.java:104)
                                         at com.worldventures.dreamtrips.core.navigation.router.FragmentCompass.replace(FragmentCompass.java:56)
                                         at com.worldventures.dreamtrips.core.navigation.router.RouterImpl.openFragment(RouterImpl.java:78)
                                         at com.worldventures.dreamtrips.core.navigation.router.RouterImpl.moveTo(RouterImpl.java:33)
                                         at com.worldventures.dreamtrips.modules.dtl.view.fragment.DtlStartFragment.navigateTo(DtlStartFragment.java:99)
                                         at com.worldventures.dreamtrips.modules.dtl.view.fragment.DtlStartFragment.openDtlLocationsScreen(DtlStartFragment.java:84)
                                         at com.worldventures.dreamtrips.modules.dtl.presenter.DtlStartPresenter.proceedNavigation(DtlStartPresenter.java:63)
                                         at com.worldventures.dreamtrips.modules.dtl.presenter.DtlStartPresenter.onLocationPermissionDenied(DtlStartPresenter.java:53)
                                         at com.worldventures.dreamtrips.modules.dtl.view.fragment.DtlStartFragment.locationPermissionDenied(DtlStartFragment.java:65)
                                         at com.worldventures.dreamtrips.modules.dtl.view.fragment.DtlStartFragmentPermissionsDispatcher.onRequestPermissionsResult(DtlStartFragmentPermissionsDispatcher.java:34)
                                         at com.worldventures.dreamtrips.modules.dtl.view.fragment.DtlStartFragment.onRequestPermissionsResult(DtlStartFragment.java:95)
                                         at android.support.v4.app.FragmentActivity.onRequestPermissionsResult(FragmentActivity.java:897)
                                         at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6582)
                                         at android.app.Activity.dispatchActivityResult(Activity.java:6460)
                                         at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
                                         at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742) 
                                         at android.app.ActivityThread.-wrap16(ActivityThread.java) 
                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393) 
                                         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) 

What can be the cause of this?

@hotchemi
Copy link
Member

It seems that this exception is not from the library. You can't replace Fragment after onSaveInstanceState is called. Please check your fragment's handling.

FYI: Consider commitAllowingStateLoss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants