I need to be able to write a string to a variable that I can load and save on additional runs of my app.
Could someone please help me with that or point me in the right direction?
Thanks
Many applications require access to a persistent storage. The two most common storage types are files and databases. We will cover text files in this tutorial. The predefined Files object has several utility methods for working with text files which are pretty easy to use. Files locations -...
I need to be able to write a string to a variable that I can load and save on additional runs of my app.
Could someone please help me with that or point me in the right direction?
Thanks
A key / value persistent store. The data is serialized using B4XSerializator and is stored in an internal database. The database can be shared between B4A, B4i and B4J. Using KVS is similar to using a Map. You initialize it once and then you can put or get items with Put, Get or GetDefault...
A key / value persistent store. The data is serialized using B4XSerializator and is stored in an internal database. The database can be shared between B4A, B4i and B4J. Using KVS is similar to using a Map. You initialize it once and then you can put or get items with Put, Get or GetDefault...
This was the avenue I ended up taking.
And I was able to get it to work.
Getting the library setup was a pain in the ass to understand but I muddled through it.
Thank you so much for your help and thank you to everyone else who also shared their methods.
Based on your question in the first post, it seems the simplest way is to save the string to a file and retrieve it
when needed. KeyValueStore2 is good, but an overkill in this case:
B4X:
Dim s As String = "B4X Community"
File.WriteString(File.DirInternal,"myfile.txt", s)
Dim savedvar As String = File.ReadString(File.DirInternal, "myfile.txt")
Log(savedvar) 'displays: B4X Community