I have an Intent that extends a ListActivity. In my onCreate
method after having populated the list adapter I use registerForContextMenu(getListView());
to register for a context menu.
Now it is working and the context menu has its original function which is; once I click and hold down on an item the context menu opens.
Can I open the context menu on a single click (without having to hold down on the list)?
All help is appreciated.
Here is another simpler way to show context menu on single click.
private void addOnClickListener() { contactList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { view.showContextMenu(); } }) }
replace contactList by your ListView
and make sure to call this method after the initialization of ListView
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With