vani
sourceimage.png

Hi …This is vani…

My first page explains how to use the popup menu(New in Honeycomb) of Android.

popup menu in Honeycomb:

In Java

 public void onPopupButtonClick(View button) {
            PopupMenu popup = new PopupMenu(this, button);
            popup.getMenuInflater().inflate(R.drawable.popup, popup.getMenu());

            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                public boolean onMenuItemClick(MenuItem item) {
                    Toast.makeText(Notepad.this, "Clicked popup menu item " + item.getTitle(),
                            Toast.LENGTH_SHORT).show();
                    return true;
                }
            });

            popup.show();
        }

In layout

<Button android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:onClick="onPopupButtonClick"
            android:text="button" />

In a sep xml:

[To add menu items]

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/search"
          android:icon="@android:drawable/ic_menu_search"
          android:title="search" />
    <item android:id="@+id/add"
          android:icon="@android:drawable/ic_menu_add"
          android:title="add" />
    <item android:id="@+id/edit"
          android:icon="@android:drawable/ic_menu_edit"
          android:title="edit">

</menu>

See the below screen short, We are adding pop up menu to Button(name I have assigned is button only, first one)
Screenshot-5556%3Ahoney-2.png