What is the best way to store data?

  1. when i store task in array list and press back button and again go back to open my app, i see that all the task are destroyed. I understand that we have to use room database or any cloud database to store it somewher. what i want to ask is when we store data in array list or shared preference where does the data get exactly stored at? like in our device where the file is created and data is stored? can we look it in android studio or in emulator?

Array list or the other local variables are stored in the stack.

Shared Preferences are stored under a xml with file location.

/data/data/APP_PACKAGE_NAME/shared_prefs/PREFS_NAME.xml

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.