views:

350

answers:

1

Hi,

I made a custom list adapter extending the Base adapter. Each item in the list has an imagebutton, 2 textviews and a button. I tried to add the context menu to the list so as to display some options for an item in the list.

registerForContextMenu(getListView());

I used a MenuInflater object to inflate the context menu xml file. But on clicking the items in the list nothing shows up or the usual highlighting of the item of list on click isn't shown. Is it that the context menu doesn't work for custom list views? Any help would be much appreciated.

Regards, Primal

+1  A: 

It should work for custom list adapters. The only thing that comes to mind is that registerForContextMenu() needs to be called after setListAdapter() (if you're using ListActivity).

Erich Douglass
For example, see: http://github.com/commonsguy/cw-android/tree/master/Database/Constants/
CommonsWare
I had done the same. But the context menu doesn't pop up on long click. :(
primalpop