Code example for PopupMenu

Methods: getMenuInflatersetOnMenuItemClickListener

			popup = makePopupWindow(context, resMenuId, parent);
	private Object makePopupMenu(Context context, int resId, View parent) {
		PopupMenu pm = new PopupMenu(context, parent);
		pm.getMenuInflater().inflate(resId, pm.getMenu());
		pm.setOnMenuItemClickListener(new OnMenuItemClickListener() {
			public boolean onMenuItemClick(MenuItem menu) {
				if (listener != null) {
					return true; 
				return false; 
		return pm;
Connect your IDE to all the code out there  Get Codota for Java