Yes, I got the reason that I override below function. onMenuItemSelected(int featureId, MenuItem item) Default implementation of onMenuItemSelected(int, MenuItem) for activities.
On Aug 28, 12:56 pm, Andrew <[EMAIL PROTECTED]> wrote: > public void onCreateContextMenu(ContextMenu menu, View view, > ContextMenuInfo menuInfo) > { > Log.d("", "create pop up menu"); > > Above log can be printed. And below log can not. > ------------------------------------------------------------------------- > > public boolean onContextItemSelected(MenuItem item) > { > Log.d("", "select the pop up menu"); > > On Aug 28, 11:44 am, Andrew <[EMAIL PROTECTED]> wrote: > > > Thanks for your help. > > > I tried according to your comments. Yes the context menu is what I > > want. But there is another question. I can't get the item selected > > event using the overrided function "onContextItemSelected(MenuItem > > item)". This function will never be called. > > > On Aug 26, 8:11 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > > > > Andrew wrote: > > > > How to implement a pop up menu? Example for pressing and holding the > > > > listview. > > > > You are looking for context menus. To implement context menus in the 0.9 > > > SDK, you need to: > > > > 1. Call Activity#registerForContextMenu(View) somewhere (e.g., in > > > onCreate()) to indicate which widget(s) get a context menu > > > > 2. Implement onCreateContextMenu() in your activity to supply the menu > > > when the user long-taps on your widget > > > > The following tutorials ship with the SDK (in samples/) that demonstrate > > > this: > > > > ./ApiDemos/src/com/android/samples/view/Gallery1.java > > > ./ApiDemos/src/com/android/samples/view/ExpandableList1.java > > > > If that didn't help, write back with more details! > > > > -- > > > Mark Murphy (a Commons Guy)http://commonsware.com > > > _The Busy Coder's Guide to Android Development_ Version 1.1 Published! --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---