I have an array list which have multiple values. I am performing Random function on array list and I want to store each random value which occurs lets say on a click of a button in list view. How can I do that?
Int rand;
String[] listv={"one","two","three","four","five"}
rand=(int)(Math.random()*5);
ArrayList<String> planetList = new ArrayList<String>(); planetList.addAll(Arrays.asList(listv[rand]));
adapter = new ArrayAdapter<String>(this, R.layout.txtlay,planetList);
listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);