Hello, Trying to set ContextMenu title according to the ListView
clicked item. The ListView contains Bookmarks list -> FAVICON +
BOOKMARK TITLE
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(0, EDIT_ID, 0, R.string.menu_edit);
menu.add(0, DELETE_ID, 0, R.string.menu_delete);
menu.add(0, SHARE_ID, 0, R.string.menu_share);
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)menuInfo;
View itemID = (info.targetView);
menu.setHeaderTitle("bla" + itemID);
}
When I run this code it shows the
android.widget.relativelay...@423d2389 or whatever and if I change the
itemID to String itemID = ((TextView)
info.targetView).getText().toString(); I get force close on long click
even though no errors are shown in Eclipse or when I run the app.
I also want to get the favicon in the same way...
Appreciate the help!
--
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