Android pop menu

I recently created an app that utilizes the Popup menu. It was useful for having multiple options for an clicked on item in a ListView or a ListActivity. To create a Popup menu I did something like this:

PopupMenu popup = new PopupMenu(Activity.this, arg1);
popup.getMenuInflater().inflate(, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
if (item.getTitle().equals(“Title”))
//do what you want if Title was picked
return true;

I also had an xml file in menu called popup.xml containing:

<?xml version=”1.0″ encoding=”utf-8″?>
<menu xmlns:android=”” >
<item android:id=”@+id/title” android:title=”Title”></item>
<item android:id=”@+id/title2″ android:title=”Title2″></item>
<item android:id=”@+id/title3″ android:title=”Title3″></item>