Android Question How to get a value saved with keyvaluestore when the application starts?

Vinicius Dias Costa

New Member
Licensed User
How to get a value saved with keyvaluestore when the application starts? I am learning how to use b4a and can not start a database variable.
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
You can save variables in a Map file

Read value on Activity_Create or better Starter Sevice
B4X:
Dim Mymap As Map
  
Mymap=File.ReadMap(File.DirInternal,"key.map")
My1=Mymap.Get("MyKey1")
My2=Mymap.Get("MyKey1")

Write On Activiy_Pause
B4X:
Mymap.Initialize
Mymap.Put("MyKey1",My1)
Mymap.Put("MyKey2",My2)
File.WriteMap(File.DirInternal,"key.map",Mymap)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top