I want to make an app and the user has two options. Put a password before entering my homescreen or if it doesn't require a password it would just redirect directly to my homescreen. My question what data storage should I use? SharedPreferences or SQLite to store the password and which is more appropriate?
-
For small data always use SharedPreferences . – Rajkumar Kumawat Feb 17 '17 at 10:55
3 Answers
SQLite is to be used for tabular data e.g. user accounts.
If you just have a single user with a single password it will be a lot easier to use SharedPreferences
, as long as you don't need to scale this to multiple users this will be absolutely fine.

- 1,863
- 13
- 20
If your application is based on the single user then better to keep the password in SharedPreference and store an encrypted password instead of the plain string.
Storing password in DB required to create a separate table which make no sense of only 1-2 users.

- 3,308
- 1
- 22
- 42
What a coincidence, i was doing the same thing and use Shared Preference!!! well both have their own benefits.. Shared preference are for quick access and are loaded in the memory for fast access along with the application while SQLite is for large amount of data storage... I would prefer you to use shared preference

- 1,022
- 1
- 8
- 28