I’m using 4list views with class extending Activity. I have to perform different list item click function. Can i use the following method code for it? So how to set a single onItemClickListener for multiple ListViews?
public void onItemClick(AdapterView<?> adapter, View view, int index, long id)
{
switch(view.getId())
{
case <listview1 Id> : //call method 1; break;
case <listview2 Id> : //call method 2; break;
case <listview3 Id> : //call method 3; break;
}
}
Set different adapters for different list views.
I take two list view for example. So take two adapter for these two. And setOnItemClick(context) will be like as below..