Hi Forum,
I have what I think should bee a very simple question. With the following code I am trying to save the number of pictures which have been taken by creating a textfile and in that only saving one number which says how many pictures have been taken.
The above code comes in activity_create. The problem I have occurs on the line 'pictureNumber = listReader.get(1). The error says 'java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0 Continue?
Any ideas?
Thank you,
Neil
I have what I think should bee a very simple question. With the following code I am trying to save the number of pictures which have been taken by creating a textfile and in that only saving one number which says how many pictures have been taken.
B4X:
If File.Exists(File.DirInternal, "Number.txt") Then
Dim listReader As List
listReader = File.ReadList(File.DirInternal, "Number.txt")
pictureNumber = listReader.Get(0)
Else
Dim TextWriter1 As TextWriter
TextWriter1.Initialize(File.OpenOutput(File.DirInternal, "Number.txt", False))
Dim listuno As List
listuno.Initialize
listuno.Add(1)
TextWriter1.WriteList(listuno)
Dim listun As List
listun = File.ReadList (File.DirInternal, "Number.txt")
picno = listun.Get(0)
TextWriter1.Close
End If
The above code comes in activity_create. The problem I have occurs on the line 'pictureNumber = listReader.get(1). The error says 'java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0 Continue?
Any ideas?
Thank you,
Neil