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 perform this action after onSaveInstanceState #20

Closed
sayah-y opened this issue Feb 20, 2017 · 7 comments
Closed

Can not perform this action after onSaveInstanceState #20

sayah-y opened this issue Feb 20, 2017 · 7 comments

Comments

@sayah-y
Copy link

sayah-y commented Feb 20, 2017

Hello,

I use the library in a fragment. When I open the camera and I click back. I have this error:

E/AndroidRuntime: FATAL EXCEPTION: main Process: ileo.eurowatt.fiqsit, PID: 6170 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=196609, result=0, data=Intent { }} to activity {ileo.eurowatt.fiqsit/ileo.eurowatt.fiqsit.ui.activity.NCSaveActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.ActivityThread.deliverResults(ActivityThread.java:3574) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617) at android.app.ActivityThread.access$1300(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1842) at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1860) at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:649) at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:609) at android.support.v4.app.DialogFragment.dismissInternal(DialogFragment.java:205) at android.support.v4.app.DialogFragment.dismiss(DialogFragment.java:171) at com.vansuita.pickimage.PickImageDialog.onActivityResult(PickImageDialog.java:214) at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:164) at android.app.Activity.dispatchActivityResult(Activity.java:6192) at android.app.ActivityThread.deliverResults(ActivityThread.java:3570) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617)  at android.app.ActivityThread.access$1300(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

I think that you need to change dismiss(); with dismissAllowingStateLoss(); in the onActivityResult of PickerDialog.

Thanks for your work.

@jrvansuita
Copy link
Owner

Ok, fixed. Changed to dismissAllowingStateLoss(), can you check for me if is it working?

@sayah-y
Copy link
Author

sayah-y commented Feb 21, 2017

Hello,

Thanks for your work :)

I see your commit but It seems that in the release v2.0.8, sources don't change. I have always dismiss(). So, the issue is always here. It's strange !
I try a full-clean with Gradle and invalidate cache and restart in Android studio. But no change.

I did a screenshot:

capture d ecran 2017-02-21 a 11 17 18

Thanks !

@sayah-y
Copy link
Author

sayah-y commented Feb 21, 2017

I just download the zip of the v2.0.8.

And I have always :

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == IntentResolver.REQUESTER) {
            if (resultCode == RESULT_OK) {
                //Show progress
                showProgress(true);

                //Handle the image result async
                getAsyncResult().execute(data);
            } else {
                dismiss();
            }
        }
    }

So, there is an error.

Thanks a lot !

@jrvansuita
Copy link
Owner

Yeap, my mistake. Try it with 2.0.9!

@sayah-y
Copy link
Author

sayah-y commented Feb 21, 2017

Good news, the issue is fixed ;)

Thanks :)

@qadir227
Copy link

qadir227 commented Sep 7, 2017

how to resolve this? I am getting it too. Should I have to edit the PickImageDialog.java library file for myself?, do I need to update the library?
I have installed the library as per docs here https://github.com/jrvansuita/PickImage#setup

@jrvansuita
Copy link
Owner

@qadir227 You need to update the library version.

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

3 participants