Q: how to stop MediaPlayer on adapter when CardStackView on Activity Swiped? i create a MediaPlayer on adapter , when user click image it start.
 public class ViewHolder extends RecyclerView.ViewHolder {
        RoundedImageView imageView;
        TextView username;
        ImageButton buttonInfo;

        public ViewHolder(@NonNull @NotNull View itemView) {
            super(itemView);
            imageView = itemView.findViewById(R.id.itemCardStackView);
            username = itemView.findViewById(R.id.textViewUsername_stackView);
            buttonInfo = itemView.findViewById(R.id.buttonToInfo_stackView);
        }
        void setData(Users data) {
            mediaPlayer = new MediaPlayer();
            if (!data.getAudioIntro().equals("")) {
                try {
                    mediaPlayer.setDataSource(data.getAudioIntro());
                    mediaPlayer.prepare();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else {
                Toast.makeText(context, "no voiceintro", Toast.LENGTH_SHORT).show();
            }
            buttonInfo.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    DialogPreviewInfo dialogPreviewInfo = new DialogPreviewInfo();
                    Bundle bundle = new Bundle();
                    bundle.putString("uid", data.getMyUid());
                    dialogPreviewInfo.setArguments(bundle);
                    dialogPreviewInfo.show(((FragmentActivity) context).getSupportFragmentManager(), "tag");
                }
            });
            
            imageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (!data.getAudioIntro().equals("")) {
                        if (mediaPlayer.isPlaying())
                            mediaPlayer.pause();
                        else {
                            mediaPlayer.start();
                        }
                    }
                }
            });
        }

it work,but i want when user swiped imageView , it stop and release MediaPlayer.i know how to use interface pass data from adapter to acivity,but opposite , i don't.
This is my code on activity for CardStackView
 manager = new CardStackLayoutManager(getContext(), new CardStackListener() {
            @Override
            public void onCardDragging(Direction direction, float ratio) {

            }

            @Override
            public void onCardSwiped(Direction direction) {
                Log.d(TAG, "onCardSwiped: p=" + manager.getTopPosition() + " d=" + direction);
                if (direction == Direction.Right) {
                    Toast.makeText(getContext(), "Direction Right", Toast.LENGTH_SHORT).show();
                }
                if (direction == Direction.Top) {
                    Toast.makeText(getContext(), "Direction Top", Toast.LENGTH_SHORT).show();
                }
                if (direction == Direction.Left) {
                    Toast.makeText(getContext(), "Direction Left", Toast.LENGTH_SHORT).show();
                }
                if (direction == Direction.Bottom) {
                    Toast.makeText(getContext(), "Direction Bottom", Toast.LENGTH_SHORT).show();
                }

                if (manager.getTopPosition() == adapter.getItemCount() - 5){
                    paginate();
                }
            }
            @Override
            public void onCardRewound() {
                Log.d(TAG, "onCardRewound: " + manager.getTopPosition());
            }
            @Override
            public void onCardCanceled() {
                Log.d(TAG, "onCardRewound: " + manager.getTopPosition());
            }
            @Override
            public void onCardAppeared(View view, int position) {
                Log.d(TAG, "onCardAppeared: " + position);
            }
            @Override
            public void onCardDisappeared(View view, int position) {
                Log.d(TAG, "onCardAppeared: " + position);
            }
        });
        manager.setStackFrom(StackFrom.None);
        manager.setVisibleCount(3);
        manager.setTranslationInterval(20.0f);
        manager.setScaleInterval(0.95f);
        manager.setSwipeThreshold(0.1f);
        manager.setMaxDegree(20.0f);
        manager.setDirections(Direction.FREEDOM);
        manager.setCanScrollHorizontal(true);
        manager.setCanScrollVertical(true);
        manager.setSwipeableMethod(SwipeableMethod.AutomaticAndManual);
        
        adapter = new CardStackAdapter(getContext(), listUser, this);
        
        binding.cardStackView.setLayoutManager(manager);
        binding.cardStackView.setAdapter(adapter);
        binding.cardStackView.setItemAnimator(new DefaultItemAnimator());

can anyone help me , please!
have a nice day,everyone!
