sameer54321
sameer54321

Reputation: 325

Is reading SharedPreferences expensive?

Would reading SharedPreferences every two hours or so alongside polling in an android application be wasteful of a user's resources?

Upvotes: 1

Views: 1576

Answers (2)

3ammari
3ammari

Reputation: 144

I don't think so , eventually your SharedPreferences are going to be stored in an XML file , key and value pairs , bigger data structures is better to be persisted with sqlite

Upvotes: 1

Erik Minarini
Erik Minarini

Reputation: 4845

You can do it, is not significantly expansive about computation.

Of course, it depends on your data; if you store a huge JSON data structure, the read will be more weight than if you use a couple of strings.

How many information you have to store? If this information is not too much is not a problem for you.

Upvotes: 2

Related Questions