I have a class called StringsA and inside it there is an array of strings:
public class StringsA {
static String Names[] = {"Larry", "Moe", "Curly", "John"};
}
In my main class there is a Button and a TextView.
What I want is to set the text of the TextView to a different word from the strings array each time the Button is clicked.
For example; the current item is "Moe", when the button is clicked, the TextView changes to "John" (the change is random, not by order).
My current Activity code:
setContentView(R.layout.main);
Button a = (Button) findViewById(R.id.button1);
TextView b = (TextView) findViewById(R.id.tv);
Resources i = getResources();
i.getResourceName(StringsA.Names);
a.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}
});
}
I'm getting error in i.getResourceTypeName. How should I change the TextView text to one of the strings when the Button is clicked?