-
Notifications
You must be signed in to change notification settings - Fork 128
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
Don't keep activities #25
Comments
@kratos23 Can you explain more? |
Easy mvp use loaders to save presenters across configuration chages. But if activity had destroyed, loader had destroyed too, and we can't restore presenter. You can test it by having enabled don't keep activities in the developer options. If you turn on this option, each activity will be destroyed after closing. |
@kratos23 So why would you expect the presenter to maintain its state when the activity is completely destroyed? I think the loader is going to somehow remove the |
@mohamad-amin I understand that
Quote from android developers about onDestory()
I expect the presenter to maintain its state, because if we save something to bundle in
system destroyed activity but not completely), EasyMVP didn't. |
@kratos23 But the problem here is that in these cases loaders don't cache the data and will be destroyed completely (as it is mentioned here, Loaders persist and cache results across configuration changes to prevent duplicate queries) So I think it's ok not to support these buggy cases because EasyMVP is using loaders and loaders are not designed for these cases. But if you really want to support these cases, you can yourself store some parameters in activity's |
@mohamad-amin could you provide a small example? Im kind of new to Android and I have a view pager with 4 tabs. I want the tabs to persist, but whenever I switch tabs or lock the phone, a new instance is created. Thanks. |
Saving presenters doesn't work with enabled don't keep activities flag in developer options.
The text was updated successfully, but these errors were encountered: