Making this tutorial: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html I have ListActivity-derived class and onCreateContextMenu, onContextItemSelected overrides. I think that it is like in Windows listbox: right-click listbox item, select popup menu item. However, I don't know how to execute this function in Android simulator: right-click on ListActivity item doesn't work, and I cannot see ContextMenu.
So, what should I do in Android emulator to see the context menu?
Long click on list using mouse until options appears .
Since the Android is designed for hand helds, there really is no idea of right clicking. On a hand held, the context menu is brought up with your finger by pressing a list item and holding until it comes up. In the simulator this becomes a click the mouse and hold.
Related
I have built an slidemenu using coboltforge.slidemenu library for android tablet. I dont want the slide to go back on item click and perform respective task on full screen. I want slide to stay on and the item click task will open in remaining space(on right). Space is not issue as it is for tablet.
For the sliding menu, I recommend https://github.com/jfeinstein10/SlidingMenu. It is widely used by popular apps like VLC for Android and Wunderlist2.
Then you should check its example of ResponsiveUIActivity and its related implementation. It is exactly what you want.
I want is a go from a menu that has a list of objects, if you select an option menu another list should appear.
The examples I found seemed to be for listview or webview.
There another way to make a selection from menu options?
So if I'm understanding your right, you want to launch a Context Menu from an Options Menu. You should not do this. From the android documentation:
A context menu is conceptually similar to the menu displayed when the user performs a "right-click" on a PC. You should use a context menu to provide the user access to actions that pertain to a specific item in the user interface. On Android, a context menu is displayed when the user performs a "long press" (press and hold) on an item.
You'd never do a "long press" on an Options Menu item. People just aren't used to doing that.
Try launching another activity instead or using a dialog.
If you have a fixed list of options in mind you might be looking for submenus, which are explained here: http://developer.android.com/guide/topics/ui/menus.html
If you are looking to dynamically build a list of options with an adapter you might find AlertDialog.Builder useful along with its setAdapter method.
Is there any way to do a popup menu that is activated by a process within the program, such as the JPopupMenu class of Swing? All I can find in the android literature is an options menu that can only be activated by pressing a menu button, and the context menu that can only be activated by a long press.
You can use a TranslateAnimation
Maybe this is also helpful: http://developerlife.com/tutorials/?p=343
Is it possible to have something similar like Blackberry in Android:
link text
I want to add a menu item particularly to the Contacts Option menu.
please let me know if this can be done in android.
Can you specify more clearly what you're trying to achieve / where you want to add the menu.
The menu that appears when you press the menu button on BB is equivalent to the menu options that come up when you press the menu button on Android.
Talking about the Contact application on Android, this would be the menu with the menu items "Search, Display options, Get Friends, My Profile, ..." in the Contact app's list view.
Take a look at http://developer.android.com/reference/android/view/Menu.html
How to open the ContextMenu in Android by Clicking a Button?
A context menu is conceptually similar to the menu displayed when the user performs a "right-click" on a PC. You should use a context menu to provide the user access to actions that pertain to a specific item in the user interface.
On Android, a context menu is displayed when the user performs a "long press" (press and hold) on an item.
Alternatively, if you need a button, you can implement the menu for the view and change the content dynamically.
Your question is bad and you should feel bad, given how readily available (if cryptic) the method behind this process is. This small tutorial helped me greatly.
http://www.mikeplate.com/2010/01/21/show-a-context-menu-for-long-clicks-in-an-android-listview/