我想使用文本字段(AutoCompleteTextView)从单击事件的字符串数组中随机获取文本值。
这里的java文件:
String[] questionsOpt = { "I just ejaculated blood", "I just eat", "I just emptied my 401k", "I just exist",
"tattooed my face", "threw up yellow stuff", "threw up in my mouth", "took a huge dump"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.start_game);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, questionsOpt);
AutoCompleteTextView actvDev = (AutoCompleteTextView) findViewById(R.id.actvDev);
actvDev.setThreshold(1);
actvDev.setAdapter(adapter);
}
如何在此处添加循环以在按钮单击事件中从字符串数组中随机查找字符串值?