saving current state
Closed this issue · 4 comments
How can I manage to save state on rotation change ?
Like I am on Page 1 that has list and decide to go to Page2, but on rotation I am on Page 1. How can I keep position on Page 2 and prevent dissapearing of that Page ?
Paginize does not support device rotation (Activity recreated) currently, I tended to keep the implementation simple and efficient, and Page recovery/restore is not implemented. If your app needs device rotation support, Paginize might not be the way to go (at least for the moment). Or if only one or two of many Pages in your app need device rotation, you can still use Paginize with multiple Activities.
Considering device rotation is quite basic feature for a general purpose framework, it may be added in the future. (deleted because this feature is already added.)
@lupajz Checkout out the latest code (a138660), I have already added support for page recovery/restore. With this feature you can easily achieve what you want.
Now you don't need to do anything and Page 2 won't disappear, Paginize will keep the stack state for rotation. You may want to override onSaveInstanceState
and onRestoreInstanceState
methods to save and restore app data, it works roughly the same way as Activity or Fragment. You can also checkout the updated demo project.
Stack state is keeped only for rotation??? or even for activity destruction???
@FunnyDevs Device rotation will cause activity to be recreated, so yes, stack state will be kept in that case.