-
Notifications
You must be signed in to change notification settings - Fork 253
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
How to find if a restartable is started already? #63
Comments
You can start it when the bundle is null in your activity:
If you still want to know if a restartable is running, you will have to copy this class to your project https://github.com/konmik/nucleus/blob/master/nucleus/src/main/java/nucleus/presenter/RxPresenter.java and add a method like this:
Edit: Also, don't register the restartable ( |
It looks like a good idea to include |
@inorichi Correct me if I am wrong, but I can't do if (savedInstanceState == null) {
getPresenter().fetchItems(id);
} because after a crash the savedInstanceState will not be null and the presenter also would be recreated, right? |
After a process restart, the restartable will restart itself (as it's name says), that's why you should store that The wiki recommends you to use Icepick for saving/restoring instances. Then you declare a variable with saved state in your presenter like so: This answer can help you understanding how restartables work too. |
Is there a method that I can call to see if a certain restartable is started? I have a restartable that is paging, and normally I would just start it in the
onCreate()
of thepresenter
but since I need arguments passed to the activity, I have to call a method in theonCreate()
of theactivity
. Now when I rotate the device, the activity is recreated and goes through the wholeonCreate()
and restarts the restartable. So, I put a boolean check to see if restartable has already started like so:Is that how you would recommend doing this or can I replace the
hasStartedPaging
variable with something that lets me check if a restartable is already started? Or am I completely doing this wrong?The text was updated successfully, but these errors were encountered: