I'm facing with a problem with my ListView, I'm trying to create a context menu when I long click on an item but when the OnCreateContextMenuList
event is called I also have the OnItemClickListener
event (and this one triggers a dialog).
A snippet of my current code :
ListView devicesList = (ListView)getView().findViewById(R.id.devices_list);
devicesList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//Here I create my dialog (I voluntarily hidden the code because I think it doesn't matter (well I think))
});
devicesList.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
Log.d(TAG, "onCreateContextMenu: yes");
//Here I need to prevent the OnItemClick event to create with serenity my menu
}
});
Could be a problem with your layout. Maybe some view is overlapping your ListView.