Code example for PopupMenu

Methods: getMenuInflatersetOnMenuItemClickListener

0
			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() {
 
			@Override 
			public boolean onMenuItemClick(MenuItem menu) {
				if (listener != null) {
					listener.OnClick(menu.getItemId());
					return true; 
				}  
				return false; 
			}			 
		}); 
		 
		return pm;
Stop searching for code, let great code find you!  Add Codota to your java IDE