I am implementing MVP for Login module in one of my project with the help of MVP sample from Google Sample. In my login module I am verifying user credentials by calling web service . On orientation change activity is getting recreated and hence the presenter too,so not able to update the UI after getting the result from the webservice.
At present I am using Fragment for Login UI and I am using setRetainInstance(true);
in Fragment's onCreate() method. Is this a good approach or what is the best approach to retain presenter?
Asked
Active
Viewed 1,180 times
1

Prabhu M
- 3,534
- 8
- 48
- 87
-
I am retaining the presenter via Dagger. You can see an example implementation at [Android Ribot Boilerplate](https://github.com/ribot/android-boilerplate) app. – azizbekian Jun 12 '17 at 12:38
-
Consider using Loaders. – Enzokie Jun 12 '17 at 13:00