Friday, 9 August 2013

How to load random line from text file in android?

How to load random line from text file in android?

I have this piece of code;
Scanner s = new Scanner(getResources().openRawResource(R.raw.game));
try {
while (s.hasNextLine()) {
System.out.println(s.nextLine());
}
} finally {
s.close();
}
How can I make to load a random line from this piece of code?
Thanks.

No comments:

Post a Comment