的价值我有这样的ListView设置:获取ListView控件的TextView
ListView listView = getListView();
listView.setTextFilterEnabled(true);
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long id) {
//
Intent i = new Intent(getApplicationContext(), Rate.class);
startActivity(i);
}
});
setListAdapter(new ArrayAdapter<String>(Items.this, R.layout.list,
items));
它是一个标准的ListView正如你看到的。每行都有一个用List“items”填充的TextView。我从MySQL数据库中提取并通过JSON循环输出。
我只希望能够单击该行,并使用其单名,并将该名称作为字符串传递给Rate.class活动。我如何在代码中做到这一点?
完美!我没有意识到arg2是索引,可以变成一个字符串。 – KickingLettuce