I am having problem setting OnClickListener to my listview. I want to open different activities when different listview item is being clicked. But i am not able to get it done.
You have to use OnItemClickListener for it.
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position,
long id) {
Intent intent = null;
switch(position){
case 0 :
intent = new Intent(HomeActivity.this,SecondActivity.class);
break;
case 1 :
intent = new Intent(HomeActivity.this,ThirdActivity.class);
break;
.......
}
startActivity(intent);
}
});