Android Question [B4X] [XUI] AS Settings KeyValueStore

wimpie3

Well-Known Member
Licensed User
Longtime User
I've seen that AS Settings uses the KeyValueStore to save the data. Is there a way to import/export these settings and store them in my own database, without passing through the KeyValueStore? Would be cool if the data could be exported/imported through a map or a json string. There seems to be a way to get hold of the KeyValueStore itself, but you can't write it back?
 

Alexander Stolte

Expert
Licensed User
Longtime User
Use the ValueChanged event to track property changes. Then you can push the change to your own database without having to manually fill all properties yourself, after application restart.

Or use AS_Settings1.SaveMode = AS_Settings1.SaveMode_Manual then nothing is saved automatically and you have to track the changes together with the valuechanged event.
And after an application restart, you simply set the values manually that come from your own database.
Use the "DefaultValue" parameter if you add a property. Example:
B4X:
Dim MyOwnProperty As Boolean = False
AS_Settings1.MainPage.AddProperty_Boolean("Basic","PropertyName_1","Light/Dark","",Null,MyOwnProperty)

or use the automatic save with the keyvaluestore and delete all settings and fill it with the values from your own database.
 
Upvote 1

wimpie3

Well-Known Member
Licensed User
Longtime User
There does seem to be an issue...

When I use
B4X:
AS_Settings1.SaveMode = AS_Settings1.SaveMode_Manual
and I try to add an action with
AS_Settings1.MainPage.AddProperty_Action("Basic","SingleSelect","Single Select","",Null,AS_Settings1.CreateList(Array("Item1"))):
the value shown on the AS Settings page is java.lang.Object@6c669567. When I leave out the SaveMode setting, it works fine.
 
Upvote 0
Top