Zain
Zain

Reputation: 59

Use SharedPref or have my own Common class with static variables?

In my android app, I have Common class with global static values where I keep all the Session data. I have not used SharedPref class, so should I use SharedPref or leave it be?

Upvotes: 0

Views: 34

Answers (1)

pop
pop

Reputation: 579

If you want your data to be persistent then use shared preference . I think session data need not to be stored in shared preference.

SharedPreference data will be stored in a file as a key pair values. If you want your session data on next launch of the app save it in shared preference.

Dont save user credentials and other security related data in shared preference.

Upvotes: 1

Related Questions