File read list NumberFormatException

Kamac

Active Member
Licensed User
Longtime User
I've encountered some problems while reading a list.

Here's how i save a list:

B4X:
all.Add(Moneyy)
File.WriteString(File.DirRootExternal,"save.txt",all)

and here's how i try to read it to a variable:

B4X:
Dim lall As List
lall = File.ReadList(File.DirRootExternal,"save.txt")
Moneyy = lall.Get(0)

B4X:
java.lang.NumberFormatException

and it's pointing at this line:
B4X:
Moneyy = lall.Get(0)

What's going on :confused:
 

Kamac

Active Member
Licensed User
Longtime User
Actually ReadList returns strings. Have you Dimmed Moneyy as Int?

Yep. Moneyy is dimmed as int... But how can i change from string which holds only number to Int?

@EDIT

lall.get(0) returns this:

B4X:
(ArrayList) [200,other numbers i'm saving separated by ,]

That's dumb :O It should return only Moneyy value which is 200.

@EDIT2

Fail.... As Klaus said, i used WriteString instead of List...
 
Last edited:
Upvote 0
Top