If you are looking for tutorials, here are some resources you can use:
https://developer.android.com/guide/topics/ui/menus.html#context-menu
http://wptrafficanalyzer.in/blog/creating-a-contextual-menu-bar-contextual-action-mode-for-a-single-view-in-android/
http://mobile.tutsplus.com/tutorials/android/android-sdk-context-menus/
Basically, you can create a layout and inflate it on clicking your button:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/menu_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip" >
<TextView
android:id="@+id/menuItem1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="@string/menu1" />
<TextView
android:id="@+id/menuItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="@string/menu2" />
<TextView
android:id="@+id/menuItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="@string/menu3" />
</LinearLayout>
and in your showPopup() method you can do something like:
public void showPopup(View v) {
LayoutInflater inflater = (LayoutInflater) MainActivity.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
PopupWindow pw = new PopupWindow(inflater.inflate(
R.layout.container, null, false), 400, 500, true);
pw.showAtLocation(findViewById(R.id.menu_layout), Gravity.CENTER, 0,
0);
}