I am a beginner and I am making a an android app. My goal is to have the app randomly return a specific word from a list of word when a button is pressed. How should I go about doing this? Also, I am using eclipse and do not have much experience at all.
Share
Since you already mentioned in your question that you want to generate a word from a list of words, I assume that you already have the list prepared.
Use the following to generate a random number and then display the word corresponding to that index.
Note : do not use Math.random (it produces doubles, not integers)
import java.util.Random;EDIT :
Assume that you have the list of words in a String array which contains 30 words.
Then, you can display wordToDisplay in your TextView by using
mTextView.setText(wordToDisplay);