Periklis Argiriadis
Sep 4, 2018 · 1 min read

Hi Lyla,
i just find out your articles and i have to admit that are understandably with nice flow and full of information for a text of 10 minutes read. Well done, Lyla, keep up the good work :)

I would like your opinion on the following scenario. In my app, the user has to create some products with name, description etc. One of the fields is category field where i use a spinner.

I use an extra activity where the user can add or edit a listview of categories, so to use them in the AddNewProductActivity. These categories are custom objects with fields as name, parent_id and category_id. I save the categories information in Firestore database into a collection.

When the category activity firstly created, a Firestore query is excecuted and all the category objects are returned.

I thought that it would be nice (and resource saver) if the categories are loaded only once and then even the activity is destroyed (the user presses the back button) and switch to the add new product activity, load locally the categories in spinner. In this way we keep the Firestore requests at minimum.

I am a bit confused if saveInstanceState() or SharedPreferences will do the job. Does my thinking sound correct?