我想用随机数填充我的数组,但我无法在TextViewer
中显示我的数组casual[]
- 帮我!在文本视图中显示数组
LanciaB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int result = np2.getValue();
int result2 = np.getValue();
result = result == 0 ? 10 : result;
int casual[] = new int[10];
for(int i=0; i < result2; i++){
casual[i] = (int) (Math.random()*10);
}
tv.setText(casual.toString());
}
});
Thx!我用你的建议,但打印的字符串不仅是数字,还包括字符和字母......是打印问题还是错误的填充随机数字的方式? – MrGun 2013-04-09 10:11:07