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

IssuerSelectionFragment doesnt store state (paymentMethod) in bundle #5

Closed
tjerkw opened this issue Sep 14, 2017 · 4 comments
Closed

Comments

@tjerkw
Copy link

tjerkw commented Sep 14, 2017

In android, a fragment might be asked to keep its instance state in a bundle,
then when the fragment is reinstantiated, the data of the bundle is used.

However IssuerSelectionFragment is setting the paymentMethod in the setArguments call in memory, this will mean it will not be there after the fragment is restored (if the app is asked to be paused and destroyed by the fragment life cycle).

When the app wants to show the fragment again it crashes:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Collection com.adyen.core.models.PaymentMethod.getInputDetails()' on a null object reference at com.adyen.ui.fragments.IssuerSelectionFragment.onCreateView(IssuerSelectionFragment.java:69) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2900) at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:603) at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) at com.tiqets.tiqetsapp.base.DebugActivity.onStart(BaseActivity.java:37) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256) at android.app.Activity.performStart(Activity.java:6959) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2890) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)  at android.app.ActivityThread.-wrap14(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6682)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)  09-14 16:20:40.732 2870-2870/? E/Zygote: v2 09-14 16:20:40.732 2870-2870/? E/Zygote: accessInfo : 0 09-14 16:20:40.844 2890-2890/? E/Zygote: v2 09-14 16:20:40.845 2890-2890/? E/Zygote: accessInfo : 0

IssuerFragment should implement the proper lifecycle methods:

https://gist.github.com/kristopherjohnson/7324450

@timon-langlotz
Copy link

Hi @tjerkw,

currently our SDK indeed doesn't handle state restoration properly. We are aware of this issue and are working on a global fix (not just in the IssuerSelectionFragment). Not all instance fields (e.g. the IssuerSelectionListener) can be persisted to a Bundle. We are investigating possible solutions.

We'll update this issue once it is resolved.

Kind regards,
Timon

@arturh
Copy link

arturh commented May 25, 2018

@timon-langlotz Artur from Tiqets here. Any news on this issue?

@timon-langlotz
Copy link

Hi @arturh,

we are working hard on an upcoming version that fixes these issues.
We'll keep you posted here!

Regards,
Timon

@timon-langlotz
Copy link

Hi @arturh and @tjerkw,

State restoration is now properly handled with version 2.0.0.

Cheers,
Timon

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