Code example for ActionProvider

0
    static final int LIST_LENGTH = 3;
 
    Context mContext;
 
    public MainOverFlowProvider(Context context) {
        super(context);
        mContext = context;
    } 
 
    @Override 
    public View onCreateActionView() {
        return null; 
    } 
 
    public View onCreateActionView(MenuItem forItem) {
        // Inflate the action view to be shown on the action bar. 
        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        View view = layoutInflater.inflate(R.layout.action_provider, null);
        ImageButton button = (ImageButton) view.findViewById(R.id.more_button);
        button.setOnClickListener(new View.OnClickListener() {
Contextual code suggestions in your IDE  Get Codota for Java