HNICofCODE Member Licensed User Nov 28, 2020 #1 in vb I would just do Code: my.settings I searched all the terms I could come up with and I cant find an answer to this. https://www.b4x.com/android/forum/threads/10608/#content and https://www.b4x.com/android/forum/posts/80837/ seemed to be close to what I am looking for but not exactly. 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
in vb I would just do Code: my.settings I searched all the terms I could come up with and I cant find an answer to this. https://www.b4x.com/android/forum/threads/10608/#content and https://www.b4x.com/android/forum/posts/80837/ seemed to be close to what I am looking for but not exactly. 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
D Deleted member 103 Guest Nov 28, 2020 #2 have you read this tutorial yet? Text files 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 -... www.b4x.com Upvote 0
have you read this tutorial yet? Text files 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 -... www.b4x.com
Biswajit Active Member Licensed User Longtime User Nov 28, 2020 #3 HNICofCODE said: in vb I would just do Code: my.settings I searched all the terms I could come up with and I cant find an answer to this. https://www.b4x.com/android/forum/threads/10608/#content and https://www.b4x.com/android/forum/posts/80837/ seemed to be close to what I am looking for but not exactly. 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 Click to expand... [B4X] KVS - KeyValueStore library 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... www.b4x.com Upvote 0
HNICofCODE said: in vb I would just do Code: my.settings I searched all the terms I could come up with and I cant find an answer to this. https://www.b4x.com/android/forum/threads/10608/#content and https://www.b4x.com/android/forum/posts/80837/ seemed to be close to what I am looking for but not exactly. 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 Click to expand... [B4X] KVS - KeyValueStore library 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... www.b4x.com
B Brian Dean Well-Known Member Licensed User Longtime User Nov 28, 2020 #4 Or you could look at PreferenceActivity. Upvote 0
HNICofCODE Member Licensed User Nov 29, 2020 #5 Biswajit said: [B4X] KVS - KeyValueStore library 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... www.b4x.com Click to expand... 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. Upvote 0
Biswajit said: [B4X] KVS - KeyValueStore library 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... www.b4x.com Click to expand... 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.
M Mahares Expert Licensed User Longtime User Nov 29, 2020 #6 HNICofCODE said: I need to be able to write a string to a variable that I can load and save on additional runs of my app. Click to expand... 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: Code: 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 Upvote 0
HNICofCODE said: I need to be able to write a string to a variable that I can load and save on additional runs of my app. Click to expand... 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: Code: 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