inflate PopupMenu - Android User Interface

Android examples for User Interface:PopupMenu

Description

inflate PopupMenu

Demo Code


//package com.java2s;
import android.content.Context;
import android.support.annotation.MenuRes;
import android.support.annotation.NonNull;
import android.view.Menu;
import android.widget.PopupMenu;

public class Main {
    @NonNull/*w ww . ja va2  s .c  o  m*/
    public static Menu inflateMenu(Context context, @MenuRes int menuResId) {
        final PopupMenu popupMenu = new PopupMenu(context, null);
        popupMenu.inflate(menuResId);
        return popupMenu.getMenu();
    }
}

Related Tutorials