What i want to do exactly is when button get clicked it goes to another activity using the "Intent" and then it generates a random article from my list of articles and then display it on screen. please just put me on the right direction and i will start researching myself because i am really stuck at the research part.
Can i use ArrayList and random from it in this case or it will be hard? or do i need to create a database for example?
List<String> list = new ArrayList<String>();
list.add(...);
list.add(...);
list.add(...);
Random rand = new Random();
String random = list.get(rand.nextInt(list.size()));
Thanks in advance..
Aucun commentaire:
Enregistrer un commentaire