0
我以为我可以使用position
int
,但是当我点击列表视图中的项目时,什么都不会发生。请帮忙!如何获取在ListView中选择的项目的值?
ListView d = (ListView) findViewById(R.id.apo);
ArrayAdapter adapt = ArrayAdapter.createFromResource(this,
R.array.algebra, android.R.layout.simple_list_item_1);
d.setAdapter(adapt);
d.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (position == '0') {
Intent intent = new Intent(Algebra.this, Alqv.class);
startActivity(intent);
}
if (position == '2') {
Intent intent1 = new Intent(Algebra.this, qfs.class);
startActivity(intent1);
}
});
}
noob错误谢谢你完美的答案 – user357032 2010-06-03 01:52:55