【发布时间】:2013-10-10 08:12:49
【问题描述】:
我正在尝试在 textView 对象中显示一个字符串。 目前我只得到字符串数组中的第一个字符串。
public void onClick(View v) {
Resources res = getResources();
String[] hintsStr = res.getStringArray(R.array.hints);
TextView hintShow = (TextView)findViewById(R.id.hintShow);
int rndInd = (int) Math.random()*5;
//hintShow.setText(rndInd);
hintShow.setText(hintsStr[rndInd]);
//System.out.print(rndInd);
}
【问题讨论】:
标签: java android string random