Papel
Papel

Reputation: 571

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

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();
                        }
                    }
                }
            });     

Upvotes: 1

Views: 38

Answers (0)

Related Questions