Android Question App settings advice

RB Smissaert

Well-Known Member
Licensed User
Developing a simple database app in B4A.
Currently I handle application settings with File.ReadMap and File.WriteMap etc. and this seems to work well. What are the benefits of using instead the PreferenceActivity or AHPreferenceActivity libraries?

RBS
 

Erel

Administrator
Staff member
Licensed User
The better alternative of File.WriteMap is KeyValueStore 2.

The purpose of PreferenceActivity is to allow the user to change the settings.
 

RB Smissaert

Well-Known Member
Licensed User
The better alternative of File.WriteMap is KeyValueStore 2.

The purpose of PreferenceActivity is to allow the user to change the settings.
Ok, in what way is it better?
I can let the user change the settings via a menu or a dedicated settings page, using File.WriteMap for persistence.
I will look into KeyValueStore 2, but I like the simplicity of File.WriteMap and File.ReadMap. Similar to an .ini file and
I am used to that.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
https://www.b4x.com/android/forum/threads/b4x-keyvaluestore-2-simple-powerful-local-datastore.63633/#content said:
however unlike Map which stores the data in memory, KVS stores the data in a database.
But I can write the Map data to a text file. I can see though that if there are a lot of settings, a database for storage has benefits, eg.
multiple text replacements. Will switch to KVS2 and see how it works.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
KVS is better than File.WriteMap because it supports complex data types.
OK, thanks. Yes, that could be handy, saving me the conversion to and from strings.
You convinced me now.
Not sure yet about PreferenceActivity or AHPreferenceActivity.

RBS
 

Erel

Administrator
Staff member
Licensed User
BTW, there are cases where File.WriteMap / ReadMap are more appropriate. For example in B4J apps it can be useful for configuration files as the user can modify it with a text editor.
 
Top