Android Create Options Menu for RecyclerView Item using PopupMenu

custom_row.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="5dp"
    android:paddingTop="5dp">

    <Button
        android:id="@+id/buttonOptions"
        android:layout_width="10dp"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_marginEnd="10dp"
        android:layout_marginRight="10dp"
        android:background="@android:color/transparent"
        android:gravity="center"
        android:text="⋮"
        android:textAppearance="?android:textAppearanceLarge" />

    <TextView
        android:layout_centerInParent="true"
        android:id="@+id/textViewNumber"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/buttonOptions"
        android:layout_toStartOf="@+id/buttonOptions"
        android:gravity="center"
        android:text="100"
        android:textAppearance="@android:style/TextAppearance.Large" />

</RelativeLayout>

NumberAdapter.java

public class NumberAdapter extends RecyclerView.Adapter<NumberAdapter.NumberViewHolder> {

    private List<Integer> integerList;
    Context context;

    public NumberAdapter(List<Integer> integerList) {
        this.integerList = integerList;
    }

    @Override
    public NumberViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        LayoutInflater inflater = LayoutInflater.from(context);

        View view = inflater.inflate(R.layout.custom_row, parent, false);

        NumberViewHolder viewHolder = new NumberViewHolder(view);

        return viewHolder;
    }

    @Override
    public void onBindViewHolder(final NumberViewHolder holder, int position) {

        Integer num = integerList.get(position);

        holder.textViewNumber.setText(String.valueOf(num));

        final Button button = holder.buttonOptions;

        holder.buttonOptions.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PopupMenu popup = new PopupMenu(context, button);

                popup.inflate(R.menu.custom_menu);

                popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        switch (item.getItemId()) {
                            case R.id.itemDelete:

                                integerList.remove(holder.getAdapterPosition());
                                notifyItemRemoved(holder.getAdapterPosition());
                                return true;
                        }
                        return false;
                    }
                });

                popup.show();
            }
        });
    }

    @Override
    public int getItemCount() {
        return integerList.size();
    }

    public class NumberViewHolder extends RecyclerView.ViewHolder {

        public TextView textViewNumber;
        public Button buttonOptions;

        public NumberViewHolder(View itemView) {
            super(itemView);

            textViewNumber = (TextView) itemView.findViewById(R.id.textViewNumber);
            buttonOptions = (Button) itemView.findViewById(R.id.buttonOptions);
        }
    }
}

References
https://github.com/mhdr/AndroidSamples/tree/master/088
https://www.simplifiedcoding.net/create-options-menu-recyclerview-item-tutorial/