Code example for MenuItem

Methods: getSubMenu, hasSubMenu

0
	public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
		mDidAction = true;
		dismiss(); 
 
		final MenuItem item = mAdapter.getItem(position);
		if (item.hasSubMenu()) {
			showMenu(item.getSubMenu(), false);
		} else { 
			if (mItemClickListener != null) {
				mItemClickListener.onMenuItemClick(item);
			} 
		} 
	} 
 
	@Override 
	public boolean onTouch(View v, MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
			mWindow.dismiss();
 
			return true; 
		}