When i click on allow permission from gallery or camera , app got crashed:
This error show :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.photoapp, PID: 4304
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=326, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.example.photoapp/ir.shahabazimi.instagrampicker.gallery.SelectActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.app.ActivityThread.deliverResults(ActivityThread.java:3977)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4020)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5811)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1844)
at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1884)
at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:329)
at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:294)
at ir.shahabazimi.instagrampicker.gallery.SelectActivity.openGallery(SelectActivity.java:70)
at ir.shahabazimi.instagrampicker.gallery.SelectActivity.onRequestPermissionsResult(SelectActivity.java:185)
at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6639)
at android.app.Activity.dispatchActivityResult(Activity.java:6518)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3973)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4020)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5811)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
When i click on allow permission from gallery or camera , app got crashed: This error show :
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.photoapp, PID: 4304 java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=326, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.example.photoapp/ir.shahabazimi.instagrampicker.gallery.SelectActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.ActivityThread.deliverResults(ActivityThread.java:3977) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4020) at android.app.ActivityThread.-wrap16(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681) Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1844) at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1884) at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:329) at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:294) at ir.shahabazimi.instagrampicker.gallery.SelectActivity.openGallery(SelectActivity.java:70) at ir.shahabazimi.instagrampicker.gallery.SelectActivity.onRequestPermissionsResult(SelectActivity.java:185) at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6639) at android.app.Activity.dispatchActivityResult(Activity.java:6518) at android.app.ActivityThread.deliverResults(ActivityThread.java:3973) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4020) at android.app.ActivityThread.-wrap16(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)