可能重复:
How to go to a particular activity on list item click?
点击listitem后如何进行下一个活动? 我有一个列表视图,当我点击一个它调用下一个活动的项目时,有三个项目
答案 0 :(得分:0)
点击后调用:
Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);
答案 1 :(得分:0)
对listview中的每个项目设置onclicklistener
listitem01.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(v.getContext(),
NextActivity.class);
startActivityForResult(myIntent, 0);
finish();
}
});
答案 2 :(得分:0)
试试这段代码
setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
switch(position)
{
case 0:
startActivity(new Intent(this, SecondActivity.class)); break;
case 1:
startActivity(new Intent(this, SecondActivity.class)); break;
case 2:
startActivity(new Intent(this, SecondActivity.class)); break;
}
}