I'm making an app as a School Project. I've never had Java classes so I don't know much about it. Basically what my app is doing is: logging in using Instagram API and saving full_name and user_name in Shared Preferences (in LoginActivity. It saves username and password so the user doesn't need to login again). When the user logs in the first time and slides to the Profile Activity his full_name gets shown in a TextView. The thing is, everytime the user reopens the app he doesn't need to login again but, when he reopens and slides to the Profile Activity his full_name won't show. What I'm asking is: Could I save the full_name in Shared Preferences on his first login and then retrieve Shared Preferences info everytime the user reopens de app? Will it work? Do Shared Preferences save the data even if the user closes and opens the app again?
2 Answers
Yes you can shared prefs to store data..and it will stay if the user reopens... But keep the following points... in mind..
Use shared prefs for small amount of data
If the user clears the cache of the app the data will be lost , so use sqllite for larger amount data..

- 10,997
- 7
- 33
- 52
Could I save the full_name in Shared Preferences on his first login and then retrieve Shared Preferences info everytime the user reopens de app?
yes
Do Shared Preferences save the data even if the user closes and opens the app again?
yes
Note: If the user goes in settings and clears application data, your application wont find the shared preferences data that was stored previously.
You can refer this answer, should give you an idea to implement the same https://stackoverflow.com/a/23024962/3518278

- 2,731
- 7
- 26
- 56