-
Notifications
You must be signed in to change notification settings - Fork 166
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
Presenter State Never Is Saved #19
Comments
As @epeterson320 has advised (pull request), there is a bug. The key (TopImagesListActivity.class) used to store the presenter instance and the key used to retrieve (TopImagesListPresenter.class) are different, so you'll always get null when trying to get the instance. |
I have a question. Is it a good idea to use the Class as the key to store/retrieve presenter instances? How do we store many instances of the same presenter? Suppose we need multiple instances to display similar data using a ViewPager. |
@epelde yes of course! @epeterson320 is right the key class of HashMap were different, we were trying to get TopArticleListPresenter instance but the right key to retrieve the instance is TopArticleListActivity.class not TopArticleListPresenter.class. although in solving @epeterson320 did the other way around and of course also works. I think that the correct solution should be: Issue
Solution
You can see TopArticleListActivity.class here. cheers! |
I've been reviewing your project seems good but I've been trying and never saves the state of the presenter.
When you save the state using PresenterHolder.getInstance () putPresenter (TopImagesListActivity.class, presenter); works well but I found that when I try to recover the state the task of being saved even then not complete when I get the instance again PresenterHolder.getInstance().getPresenter (TopImagesListPresenter.class); always is null.
Your example
Do you have any other alternative that you used?
Thank you for your contribution and your awesome job!
The text was updated successfully, but these errors were encountered: