Android MenuInflater - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MenuInflater class.

This code example shows how to use the following methods:
        return mCustomView != null ? mCustomView.get() : null;
    } 
 
    @Override 
    public MenuInflater getMenuInflater() {
        return new MenuInflater(mContext);
    } 
 
    public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
        return mCallback.onActionItemClicked(this, item);
    } 
 
    public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
    } 
 
    public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
        if (!subMenu.hasVisibleItems()) {
            return true; 
        } 
 
7
CodeRank
This code example shows how to use the following methods:
        return mCustomView != null ? mCustomView.get() : null;
    } 
 
    @Override 
    public MenuInflater getMenuInflater() {
        return new MenuInflater(mContext);
    } 
 
    public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
        return mCallback.onActionItemClicked(this, item);
    } 
 
    public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
    } 
 
    public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
        if (!subMenu.hasVisibleItems()) {
            return true; 
        } 
 
7
CodeRank
This code example shows how to use the following methods:inflate
	public void inflate(int menuId) {
		// done without using the PopupMenu.inflate() method, which isn't available on Honeycomb. 
		// this method works on both Honeycomb and Ice Cream Sandwich. 
		MenuInflater inflater = menu.getMenuInflater();
		Menu baseMenu = menu.getMenu();
		inflater.inflate(menuId, baseMenu);
	} 
	 
	public void show() { 
		menu.show();
	} 
	 
	static { 
		try { 
			Class.forName("android.widget.PopupMenu");
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} 
	} 
	 
6
CodeRank
This code example shows how to use the following methods:
	public Menu getMenu() {
		return mMenu;
	} 
 
	public MenuInflater getMenuInflater() {
		return new MenuInflater(mContext);
	} 
 
	public void inflate(final int menuRes) {
		new MenuInflater(mContext).inflate(menuRes, mMenu);
	} 
 
	public boolean isShowing() { 
		return mWindow != null && mWindow.isShowing();
	} 
 
	@Override 
	public void onDismiss() { 
		if (!mDidAction && mDismissListener != null) {
			mDismissListener.onDismiss(this);
7
CodeRank
This code example shows how to use the following methods:
        return mCustomView != null ? mCustomView.get() : null;
    } 
 
    @Override 
    public MenuInflater getMenuInflater() {
        return new MenuInflater(mContext);
    } 
 
    public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
        return mCallback.onActionItemClicked(this, item);
    } 
 
    public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
    } 
 
    public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
        if (!subMenu.hasVisibleItems()) {
            return true; 
        } 
 
6
CodeRank
This code example shows how to use the following methods:inflate
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) 
	{ 
	    MenuInflater inflater = getMenuInflater();
	    int menuID = getResources().getIdentifier("io_openkit_leaderboards", "menu", getPackageName());
	    inflater.inflate(menuID, menu);
	    //inflater.inflate(R.menu.io_openkit_leaderboards, menu); 
	    return true; 
	} 
 
} 
5
CodeRank
This code example shows how to use the following methods:inflate
    public void onClick(View v) {
    } 
     
    @Override 
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.menu_camera, menu);
        super.onCreateOptionsMenu(menu, inflater);
    } 
     
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        if ( item.getItemId() == R.id.menu_take_video ) {
            try { 
                if ( mCameraView.isRecording() ) {
                    mCameraView.stopRecording();
                } else { 
                    mCameraView.startVideoRecording(getActivity().getExternalCacheDir()+File.separator+
                            UUID.randomUUID().toString(), CameraProfile.QUALITY_HIGH);
                } 
            } catch (Exception e) {
5
CodeRank
This code example shows how to use the following methods:inflate
     * Method that inflates the menu. 
     * 
     * @param menuResourceId The resource identifier of the menu to be inflated 
     */ 
    private void inflateMenu(int menuResourceId) {
        MenuInflater inflater = new MenuInflater(this.mContext);
        inflater.inflate(menuResourceId, this.mMenu);
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public int getCount() { 
        return this.mMenu.size();
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
5
CodeRank
This code example shows how to use the following methods:
        return LayoutInflater.from(realActivity);
    } 
 
    @Implementation 
    public MenuInflater getMenuInflater() {
        return new MenuInflater(realActivity);
    } 
 
    /** 
     * Checks to ensure that the{@code contentView} has been set 
     * 
     * @param id ID of the view to find 
     * @return the view 
     * @throws RuntimeException if the {@code contentView} has not been called first 
     */ 
    @Implementation 
    public View findViewById(int id) {
        if (contentView != null) {
            return contentView.findViewById(id);
        } else { 
5
CodeRank
This code example shows how to use the following methods:inflate
	} 
	 
	 
	@Override 
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	    inflater.inflate(getMenu(), menu);
	} 
	 
	public void destroy() {	 
	} 
	 
	public void background() {	 
	} 
 
	 
	public void pause() { 
	} 
	 
	public void start() { 
	} 
5
CodeRank

Related Android MenuInflater Questions & Answers:

Other Android MenuInflater Examples

34:	  @Override
35:	  public boolean onCreateOptionsMenu(Menu menu) {
36:	    MenuInflater inflater = getMenuInflater();
37:	    inflater.inflate(R.menu.mainmenu, menu);
38:	    return true;

Read More

8:		@Override
9:		public boolean onCreateOptionsMenu(Menu menu) {
10:			MenuInflater inflater = getMenuInflater();
11:			inflater.inflate(R.menu.activity_main_actions, menu);
12:

Read More

18:	    public boolean onCreateOptionsMenu(Menu menu)
19:	    {
20:	        MenuInflater menuInflater = getMenuInflater();
21:	        menuInflater.inflate(R.layout.menu, menu);
22:	        return true;

Read More

1:		public boolean onCreateOptionsMenu(Menu menu) {
2:			MenuInflater inflater = getMenuInflater();
3:			inflater.inflate(R.menu.activity_main_actions, menu);
4:

Read More

1:	@Override
2:	public boolean onCreateOptionsMenu(Menu menu) {
3:	    MenuInflater inflater = ;
4:	    inflater.inflate(R.menu.game_menu, menu);
5:	    return true;

Read More

1:	public void showPopup(View v) {
2:	    PopupMenu popup = new PopupMenu(this, v);
3:	    MenuInflater inflater = popup.getMenuInflater();
4:	    inflater.inflate(R.menu.actions, popup.getMenu());
5:	    popup.show();

Read More

3:	                                ContextMenuInfo menuInfo) {
4:	    super.onCreateContextMenu(menu, v, menuInfo);
5:	    MenuInflater inflater = getMenuInflater();
6:	    inflater.inflate(R.menu.context_menu, menu);
7:	}

Read More

See Code Examples for Android MenuInflater Methods: