user2392465
user2392465

Reputation: 21

Usage of Shared Preferences in android library projects

Usage of Shared Preferences in android library projects is allowed?I am trying to work on rating bar but i am not sure whether i can use Shared preferences to write that.

Upvotes: 1

Views: 582

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007584

If you have a Context, supplied to you by the app that is using your library, you can use SharedPreferences.

However, you need to be a bit careful to ensure that you do not accidentally try using the same keys as the app might use. You might consider using a unique SharedPreferences file, rather than getDefaultSharedPreferences().

Upvotes: 1

Related Questions