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
Activity State not getting restored when the activity is killed and restored #24
Comments
The Intent obtained in the getIntent is the original one, it ignores all the changes made during the ActivityStarter.fill(). One way to fix this would be to save the state in the Bundle "outState" that is provided in the onSaveInstanceState. And use the bundle provided in the onCreate method to restore the state if present. |
You are right. I made this change to allow saving state on property delegates (Kotlin). What do you think about the following generation proposition? Original:
Generated:
|
@danieldisu Can you check version issue_24-SNAPSHOT
|
Thank you for you fast response!! I've tried it and is still not working, it's almost there! The Save method now is 100% OK, but it's also needed to change the FILL method, to also receive the bundle, in order to load the saved info from it when present. |
I think it should be ok in current SNAPSHOT |
The generic method ActivityStarter.fill() still doesn't have the possibility to pass the bundle. But using the ActivityNameStarter.fill(activity, bundle) method works like a charm! Do you think it would be possible to add an overloaded method ActivityStarter.fill() that receives the Bundle? |
In the published version, there is |
Everything is working now! Thanks!! |
But this is not the solution because it does not allow Kotlin property delegates to read state from saved bundle. I am still working on this issue. |
I see the problem, but it's going to be a hard one to crack because there is no way to access the savedInstanceState Bundle outside the lifecycle methods. |
I see now that there is no way to do it. I will fill values if savedInstanceState is not null and if the property is read-write. |
Today I finally had more time to fix this problem. From new version, Kotlin needs also |
Hi
I've find a bug in the library when using ActivityStarter.save(this) in the onSaveInstanceState that causes the state to not be saved and instead restoring the App with the original Intent when setting the debug option Don't keep activities, this setting only forces the system to kill the activity, but it's a behaviour that happens in the wild.
You can see the code reproducing the bug here https://gist.github.com/danieldisu/692c11c1e9eb26a1f27a895c57209a75
Ways to reproduce:
Set "Don't keep activities" in the emulator
Init activity with 2 arguments.
Modify one argument.
Navigate to another app and go back to the app
Expected behaviour
The changed argument is changed and the other one is untouched.
Real behaviour
The arguments are the original ones
The text was updated successfully, but these errors were encountered: