Android Question Saving a variable in memory

red30

Well-Known Member
Licensed User
Longtime User
Public const=0 As Int
There is a public const that changes its value in the programme. How can I save this value in memory when closing the programme in order I could use it when open the programme the next time?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
Is there an easier way? I need to write only one integer type value. And every time you start the program to watch it.
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
I have a variable: Public const=0 As Int
In the program, I changed it to: const=1
How do I save it and the next time you start reading?
It can be an example please!
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
Most simplest example: (from B4A IDE info)

Write it:
B4X:
File.WriteString(File.DirRootExternal, "1.txt", "Some text")

Read it:
B4X:
Dim text As String
text = File.ReadString(File.DirRootExternal, "1.txt")

See File object for more options
 
Upvote 0
Top