Firiam
Firiam

Reputation: 55

Is it worth it to create new Class only for sharedPreferences methods?

I'm using sharedPreferences to save my app/game progress and I have 5 different methods to save/load/delete data from sharedPreferences. I'm wondering if it's good practise to create new Class only for those methods and make them static? Thank you for your help!

Upvotes: 2

Views: 53

Answers (2)

Runner5
Runner5

Reputation: 94

I think if you are saving that much data and find yourself calling those SharedPreferences methods a lot then it might be worthwhile to use SQLite to save data instead.

Upvotes: 1

Boots
Boots

Reputation: 181

If you are frequently storing a lot of preference values, it can clean up your code if you create a preferences helper class that handles the storage/retrieval of configuration values. It will keep your code clean, easy to read and give you one single place to maintain your preferences.

Upvotes: 3

Related Questions