I have a view flipper with two listviews inside. I have registered onLongLickListener to both of the listViews. I can get the position etc of the item when I press something on contextmenu, but I cannot get which listView owns the current menu. if needed, I can provide some codes, thanx in advance.
Called these two in onCreate
listView1.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> l, View v,
int position, long id) {
selected_list = 1;
return false;
}
});
listView2.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> l, View v,
int position, long id) {
selected_list = 2;
return false;
}
});
that worked and used this way:
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo();
if(selected_list==1){
//do something.
}else if(selected_list==2){
//do o/w
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.