Android Question Random Row in txt file

ehsan1111

New Member
Hi
I'm newbie in b4a
I have a text file.

text.txt contents:
first row
second row
third row
.
.
.

How can I create an button to display a random row by each click?

thank you
 

Eric H

Active Member
Licensed User
Longtime User
Do a search for my hangman tutorial in the forum. I have some code that would be helpful for you along with an explanation of how it works. Let me know if you have questions beyond that and I'll see if I can help.

Eric
 
Upvote 0

ehsan1111

New Member
Do a search for my hangman tutorial in the forum. I have some code that would be helpful for you along with an explanation of how it works. Let me know if you have questions beyond that and I'll see if I can help.

Eric
hi , That was very nice tutorial. fantastic. thank you

Something like:
B4X:
'read the file once:
Dim rows As List = File.ReadList(...)

'select row
Dim row As String = rows.Get(rnd(0, rows.Size))
Thanks for your good support dear Erel
Solved.
 
Upvote 0
Top