I have a bunch of strings in strings.xml
, named eg a1, a2, a3, a4:
<string name="a1">url1</string>
<string name="a2">url2</string>
<string name="a3">url3</string>
<string name="a4">url4</string>
I've setup a randomiser to create a random number, eg between 1 and 4
I've then created a variable to add the letter 'a' to the random number eg a3
String url = "a" + (+randint);
This prints 'a3' successfully:
System.out.println((url));
I'm now trying to display the contents of the 'a3
' string in textview or even just System.out.((url))
but can't figure out how to expand the variable as url3
. At best I can only pull out 'a3'. Any ideas?