On Mon, May 30, 2011 at 3:37 AM, OktaEndy <[email protected]> wrote: > i want to make a context menu which is depend on selected listview > item, for example : > > list view item : > a > b > c > d > > if i press longclick on item : > - a,b, context menu will show menu x, y > - c, context menu will show menu z > - d, doesn't show context menu
Your last scenario may not be possible and would be lousy UX even if it were. The first two are simply a matter of examining the ContextMenu.ContextMenuInfo object passed to onCreateContextMenu(). For a context menu on a ListView, that object will really be an instance of AdapterView.AdapterContextMenuInfo. Once you cast the object to be a AdapterView.AdapterContextMenuInfo, you can access the position of the list item that was long-clicked (also it's _id value, if this is backed by a CursorAdapter). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in Oslo: http://bit.ly/fjBo24 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

