Search code examples
androidsqliteandroid-sharedpreferences

Which of SQLite or sharedpreferences is better for a registration system in an Android application?


I'm in the process of developing a application and I wanted to know if its better to use sharedpreferences to create a login, register and also logout functionality in Android Studio app instead of using Sqlite?

I am new to Android development.


Solution

  • About that its totally on your choice what you use to save the current state of user , i will prefer using shared preferences. And for signup and sign in use SQLite database. Shared preferences are commonly used to perform light operations. You can search through data in SQLite as you may have many users.

    So use SQLite to register and login and then use shared preferences to save tha current state of user.

    Shared Prefences

    sharedPreferences is a key/value store where you can save a data under certain key. To read the data from the store you have to know the key of the data. This makes reading the data very easy. But as easy as it is to store a small amount of data as difficult it is to store and read large structured data as you need to define key for every single data.