Android Question Saving and Loading a string between app runs.

HNICofCODE

New Member
Licensed User
D

Deleted member 103

Guest
have you read this tutorial yet?
 
Upvote 0

Biswajit

Active Member
Licensed User
Longtime User
 
Upvote 0

HNICofCODE

New Member
Licensed User
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

Mahares

Expert
Licensed User
Longtime User
I need to be able to write a string to a variable that I can load and save on additional runs of my app.
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
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…