I am working on an application that have use internet.
What i want to do if connection available than option menu showing if not than hide specific menu. & when internet available application show all menu item.
You can try this. removeItem
You just have to pass an Id of your menu item that wants to hide. Add item again whenever you want.
Related
I have implemented the SlidingMenu successfully.
What my requirement is that I have a menu in the form of listview .
Now few of the list items have one more component (e.g. status) which needs to be updated dynamically everytime the user opens the menu.
I'm not able to achieve this.
Please help me .
You have to override the method which is called when the slider is opened. There you have to add the code to update your list data.
In my application I am having 3 menu like options,setting and favorites. In that If I press 'favorites' means it should display another set of (new)menu and I want to hide the previous set of (old)menu. IS it possible with android? If anyone knows, help me please.
I'm not sure if this is possible, but it's not the bast idea to do such things. Main reason - this behavior will be unexpected for user.
On selecting option menu item you should show alert dialog with possible choices.
Offtopic: According new design guidelines Android will delete "menu button", and all actions will appear on action bar. May be this will be better for your purposes.
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 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/