Ok thanks, well I ended up using the following.. AdapterView.AdapterContextMenuInfo info; info = (AdapterView.AdapterContextMenuInfo) menuInfo; ListView lv = getListView(); String title = lv.getItemAtPosition(info.position).toString();
I realize there are other ways of achieving this, what would the best be? I don't seem to be able to grab the text as easily using any other methods. Thanks. On Oct 15, 1:48 am, Mark Murphy <mmur...@commonsware.com> wrote: > Lee Jarvis wrote: > > That works great, thankyou. > > > One more thing, though. I have tried to mess around with > > onContextItemSelected() and attempted to get the original text from > > the list item I clicked through the ContextMenuInfo interface, but > > there doesn't seem to be a clear way to achieve this. All I basically > > need to (lets say, set a favorite) is the title or string of the list > > item I clicked to bring up the context menu. > > Inside an onContextItemSelected(MenuItem item) method, you can do: > > AdapterView.AdapterContextMenuInfo info= > (AdapterView.AdapterContextMenuInfo)item.getMenuInfo(); > > That will give you the ID, position, and View of the row in the ListView > that was long-tapped to bring up the context menu. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _The Busy Coder's Guide to *Advanced* Android Development_ > Version 1.1 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---