or-dvir / EasySettings

A library for easily creating and adding settings (AKA preferences) to your android app
Apache License 2.0
95 stars 18 forks source link

Store data in sqlite #7

Closed psohm closed 5 years ago

psohm commented 5 years ago

It would be useful to store data in a sqlite database Is it possible to integrate external saving ?

or-dvir commented 5 years ago

why would it be useful? this doesnt make any sense. databases are meant to hold a large and complex amount of data where settings are just basic types (numbers and strings). also accessing a database is a much more expensive operation than accessing SharedPreferences (and accessing that data could happen a lot during an apps' life cycle).

can you please explain why you would want to do this?

psohm commented 5 years ago

Sure I have an application which store config file for one company I'd like to configure now multiple company and also to sync it with a server

Le mer. 13 févr. 2019 à 06:48, Or Dvir notifications@github.com a écrit :

why would it be useful? this doesnt make any sense. databases are meant to hold a large and complex amount of data where settings are just basic types (numbers and strings). also accessing a database is a much more expensive operation than accessing SharedPreferences (and accessing that data could happen a lot during an apps' life cycle).

can you please explain why you would want to do this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/or-dvir/EasySettings/issues/7#issuecomment-463068475, or mute the thread https://github.com/notifications/unsubscribe-auth/AFnSvLOq3D-dncft9Y71ESDqDl1DLNAQks5vM6cqgaJpZM4a3Qon .

or-dvir commented 5 years ago

how big of a configuration file? if not too big, you can possibly convert it to json and then store that as a string. it sounds like the "regular" way of storing settings/preferences does not suit your needs, and this library is meant to be as close to the "regular" way as possible.

psohm commented 5 years ago

i think it is a good idea to store in a json file.

how would do you proceed, would you store in shared pref file and then migrate it in json ? or would you directly store in json with a lib ?

or-dvir commented 5 years ago

i meant store the json as string (which you can save to shared preferences), not a file. i dont know the specifics of your app requirements and how this configuration file is built, but maybe instead of in a file you can save those configurations as a json string and then save that string to shared preferences