patri9ck / a2ln-app

A way to display Android phone notifications on Linux (App)
GNU General Public License v3.0
83 stars 7 forks source link

Preference storage #11

Closed Domi04151309 closed 2 years ago

Domi04151309 commented 2 years ago

It might make more sense to use Android preferences for storing data instead of a custom implementation. In case the custom implementation should be kept I suggest using a singleton for that instead of passing the configuration over the activity intents.

patri9ck commented 2 years ago

Do you maybe have a tutorial for Android preferences?

Domi04151309 commented 2 years ago

Sure! You can use PreferenceManager.getDefaultSharedPreferences(context) to get the default SharedPreferences that cotains set methods. To edit preferences you have to use the [edit()](https://developer.android.com/reference/android/content/SharedPreferences#edit()) method. You can then make changes and use [apply()](https://developer.android.com/reference/android/content/SharedPreferences.Editor#apply()) when you're done.

But it may not be the best solution because it is mainly focused on key value pairs.

patri9ck commented 2 years ago

Thank you, I will take a look at it.