0

I've created an application which contains settings as int values... Basically my app contains multiple layouts. When the user presses the "back" key, the app returns to the first panel (which is the main screen!). If pressed on the main screen, the app will pause/finish. The integer values that I have are what I use to determine whether the user has done something in the app. They also determine which layout the user is in. I really need to have these int values for when the user opens the app again. What is the best way that I should go about saving multiple int values so that I can access them if the app is killed?

Thanks


Sorry... I'm finding it really hard to write and read to and from a map file... Here is what I have so far simplified. Can you see if I am missing something... more than likely its really easy.

Sub Activity_Resume

Dim m As Map

m.Initialize

If File.Exists(File.DirInternal, "1.txt") Then

m = File.ReadMap(File.DirInternal,"1.txt")

int1 = m.Get("int1")

int2 = m.Get("int2")

End If

End Sub

Sub Activity_Pause (UserClosed) As Boolean

Dim m As Map

m.Initialize

m.Put("int1", int1)

m.Put("int2", int2)

File.WriteMap(File.DirInternal, "1.txt", m)

End Sub

Tim Post
  • 33,371
  • 15
  • 110
  • 174
  • Welcome to Stack Overflow! If you'd like to add additional information to your question, just edit your question (click the 'edit' link underneath your question). To comment on an answer you've received, use the comment facility under the answer. If you find the comment space insufficient, you should probably be making an edit. Answers should be just that, direct answers to your question. – Tim Post Oct 25 '11 at 10:53

1 Answers1

0

You have several options. You can use StateManager or you can store the settings in a Map and then in Activity_Pause save the Map with File.WriteMap, and read the Map in Activity_Create if the file exists.

Erel
  • 1,802
  • 2
  • 15
  • 58
  • Sorry for the bad questions Erel... But all I really need to do is save int Values. Will a map work efficiently or should I maybe use stringread and stringwrite to write them each to a file? Thanks for your time – TheJackster14 Oct 22 '11 at 21:16