How to use MediaPlayer audio list in custom listview specific icon?

49 Views Asked by At

I want to use a audiolist in my custom listview and I want to if I click specific icon in listview then audio should work.

                @Override
                public void onClick(View v) {
                    if (position==0){
                        player = MediaPlayer.create(getContext(), R.raw.loveee);
                        player.start();

                    }else if (position==1){
                        if (player.isPlaying()){
                            player.pause();
                            player = MediaPlayer.create(getContext(), R.raw.hello);
                            player.start();
                        }
                    }
                }
            });     
0

There are 0 best solutions below