i am trying to display a random string each time a button is pressed from a set of strings defined in strings.xml . this is an example of the strings ID\'s
&
create string array in res/values/array.xml:
aalia asin sonakshi kajol madhuri
then in your activity write the code
String[] array = context.getResources().getStringArray(R.array.custom_array); String randomStr = array[new Random().nextInt(array.length)]; text_dialog.setText(""+randomStr);