Answer the question
In order to leave comments, you need to log in
How to save data from an array after recreating an activity?
There is an array with images, after re-creating the activity, the array starts working from the very beginning. Is there a way to continue the array (i.e. change pictures) after the activity is recreated?
Answer the question
In order to leave comments, you need to log in
It is necessary to save all critical data somewhere. For simple ones, SharedPreferences will do. Activities and fragments also have an onSaveInstanceState method - there you can save data in a Bundle, get it in onCreate / onRestoreInstanceState. More important data should be stored in the database, you can use a lot of things - SQLite + StorIO, for example (but this is only for example, there are many options). Images should not be stored in the database, but simply stored in files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question