Archive

Archive for the ‘Menu’ Category

Using Context Menus in Android

November 6, 2009 2 comments

We moved. Please visit this link for this post.

 

 

 

Context menu in Android is similar to context menu in any others OS.

In Microsoft Windows or in any Linux distr you click right mouse key and see context menu. The same is in Android, but you press and hold your view which has context menu. Read more…

Advertisements
Categories: Android, Android how to, Menu

Adding alphabetic shortcut to the menu item in Android

November 6, 2009 Leave a comment

We moved. Please visit this link for this post.

 

 

 

There is a way to add shortcut to your menu item.

I am going to show how it can be done.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
	menu.add(0, NEW_MENU_ITEM, 0, "New").setAlphabeticShortcut('N');
...
	return super.onCreateOptionsMenu(menu);
}

As you see it is very easy.
How you can test it? Run your code with this snippet, click Menu button and after click “N”.

Categories: Android, Android how to, Menu

Adding icon to the menu item in Android

November 4, 2009 Leave a comment

We moved. Please visit this link for this post.

 

 

 

There is a good practice to add icons to the menu items.

I am going to show code snippet which add icon to the menu item:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
   menu.add(0, ADD_MENU_ITEM, 0, "Add").setIcon(android.R.drawable.ic_menu_add);
   return super.onCreateOptionsMenu(menu);
}

This code adds icon add to the menu item ADD_MENU_ITEM.

As you see this is simple operation.

Categories: Android, Android how to, Menu

Working with Submenu in Android Activity

November 4, 2009 Leave a comment

We moved. Please visit this link for this post.

 

 

 

Submenu is a another way to group your menu items.

I am going to show how to create, add items and handle items selection. Read more…

Categories: Android, Android how to, Menu

Operations with Options Menu items group

November 1, 2009 Leave a comment
We moved. Please visit this link for this post.
Sometimes need to group your Options menu items.
Group is very useful when you need to work (remove, disable or hide) with several menu items.
I am going to show example about how to remove, disable/enable and hide/show group of menu items. Read more…
Categories: Android, Android how to, Menu

Handling Options Menu item selections in Android

October 29, 2009 Leave a comment

We moved. Please visit this link for this post.

 

 

 

I showed previously how to create an Options menu and how to add Menu item to it.

Now I am going to show how to handle options menu item selection.

I will show code snippet and after whole example. Read more…

Categories: Android, Android how to, Menu

Creating Options Menu and adding menu items to the Options Menu in Android

October 26, 2009 1 comment

We moved. Please visit this link for this post.

 

 

 

From this post I am going to start series posts about Menu. Menu is very important. I will try to show all actions with menus in next posts.

Maybe it will be better to write one big article, but there are 2 problems from my side.

  1. Now I have no free time. All team works hard because we want to publish our updated applications in earlier November
  2. I like short but useful examples in manner how to Read more…
Categories: Android, Android how to, Menu