PopupWindow по нажатию воспроизводит Toast

Как сделать так, чтобы по нажатию на кнопку, находящуюся в PopupWindow, воспроизводило Toast?

Проблема в том, что я не знаю куда нужно писать сам onClickListener. Пробовал создать отдельный Activity, в котором реализовано нажатие с помощью sort_by_cost.setOnClickListener(v -> {Toast.makeText(this,"Text!",Toast.LENGTH_SHORT).show();});, но это не сработало. Помогите реализовать.

Fragment, в котором находится LinearLayout, по нажатию на который появляется PopupWindow:

public class FragmentAttractionRecyclerView extends Fragment {

    private RecyclerView mRec;
    private AdapterAttractions adapter;
    public ArrayList<ItemAttractions> exampleList;
    private Spinner spinner_sort;
    private RecyclerView.LayoutManager mLayoutManager;
    private TextView card_1, textq;
    private TextView sort_by_alphabet, sort_by_cost, sort_by_type;

    public final String[] mArraysNames = new String[]{"Baby островок", "Виражи", "Вокруг света", "5D кинотеатр"};
    HomeActivity_test fragment = new HomeActivity_test();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRetainInstance(true);
        OnBackPressedCallback callback = new OnBackPressedCallback(true) {
            @Override
            public void handleOnBackPressed() {
                Intent homeIntent = new Intent(Intent.ACTION_MAIN);
                homeIntent.addCategory(Intent.CATEGORY_HOME);
                homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(homeIntent);
            }
        };

        requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_attraction_test_2, container, false);

    }

    @SuppressLint("InflateParams")
    @Override
    public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
        createExampleList();
        buildRecyclerView();


        ImageView sort_alphabet = requireView().findViewById(R.id.sort_alphabet);
        LinearLayout dialog_button = requireView().findViewById(R.id.dialog_button);
        dialog_button.setOnClickListener(FragmentAttractionRecyclerView.this::showPopup);


        sort_alphabet.setOnClickListener(v -> {
            sortArray();
            sortArrayList();
        });


        SearchView searchView = requireView().findViewById(R.id.searchView);
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                adapter.getFilter().filter(newText);
                return false;
            }
        });
    }

    private void sortArray() {
        Arrays.sort(mArraysNames);
        adapter.notifyDataSetChanged();
    }

    private void sortArrayList() {
        Collections.sort(exampleList, (o100, o200) -> o100.get_attraction_cost().compareTo(o200.get_attraction_cost()));
        adapter.notifyDataSetChanged();
    }

    public void createExampleList() {
        exampleList = new ArrayList<>();
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_kid, "Baby островок", "Детский", "60₽", 0));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_kid, "Виражи", "Детский", "80₽", 1));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_kid, "Вокруг света", "Детский", "50₽", 2));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_interactive, "5D кинотеатр", "Интерактивный", "120₽", 3));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_family, "Кокосовый страйк", "Детско-семейный", "85₽", 4));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Компас", "Экстримальный", "100₽", 5));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Лабиринт \"Тарзан\"", "", "", 6));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Лови волну", "", "", 7));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Лучный тир \"Робин Гуд\"", "", "", 8));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Муравейник", "", "", 9));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Полный улёт", "", "", 10));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Попрыжек", "", "", 11));
        exampleList.add(new ItemAttractions(R.mipmap.unnamed, R.drawable.ic_extreme, "Предел эмоций", "", "", 12));
    }

    public void buildRecyclerView() {
        mRec = requireView().findViewById(R.id.attraction_recycler);
        adapter = new AdapterAttractions(exampleList);
        mLayoutManager = new LinearLayoutManager(getContext());
        mRec.setLayoutManager(mLayoutManager);
        mRec.setAdapter(adapter);
    }

    public void showPopup(View v) {
        LayoutInflater layoutInflater = (LayoutInflater) requireActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        @SuppressLint("InflateParams") final View popupView = layoutInflater.inflate(R.layout.popup_filter_layout, null);

        PopupWindow popupWindow = new PopupWindow
                (popupView,
                        ViewGroup.LayoutParams.WRAP_CONTENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT);
        
        popupWindow.setOutsideTouchable(true);
        popupWindow.setOnDismissListener(() ->
        {
            //TODO do sth here on dismiss
        });
        popupWindow.showAsDropDown(v);
    }
}

xml файл, в котором находится кнопка, которая должна запускать Toast:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/color_6"
    android:orientation="vertical">

    <androidx.cardview.widget.CardView
        android:id="@+id/Card"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="6dp"
        android:backgroundTint="@color/color_2"
        app:cardCornerRadius="6dp"
        app:cardElevation="2dp">

        <androidx.cardview.widget.CardView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="1dp"
            android:orientation="horizontal"
            app:cardCornerRadius="5dp"
            app:cardElevation="2dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <Button
                    android:id="@+id/sort_by_alphabet"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:clickable="true"
                    android:focusable="true"
                    android:padding="10dp"
                    android:text="По алфавиту"
                    android:textSize="16dp" />

                <TextView
                    android:id="@+id/sort_by_cost"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:padding="10dp"
                    android:text="По стоимости"
                    android:textSize="16dp" />

                <TextView
                    android:id="@+id/sort_by_type"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:padding="10dp"
                    android:text="По типу"
                    android:textSize="16dp" />
            </LinearLayout>
        </androidx.cardview.widget.CardView>
    </androidx.cardview.widget.CardView>
</LinearLayout>

Ответы (0 шт):