问题描述
我使用的ListView适配器tracks.Each列表项的显示列表中的播放和停止图标,播放和停止我有track.The问题是赛道被打一次,当我第一次点击播放button.After的如果我通过点击停止按钮和尽量发挥它没有得到我发现played.Through敬酒消息的任何曲目停止了holder.img1.setOnClickListener()方法被调用,但是,prepared()方法不会被调用上点击播放按钮进行第二次或以后that..If我替换 mMediaPlayer.pause();
按 mMediaPlayer.release ();
我仍然得到同样的result..If我把 mMediaPlayer =新的MediaPlayer();
里面的onClick()方法 holder.img1.setOnClickListener
上面的问题不会得到解决,但随后点击多个播放按钮开始播放在同一时间多首曲目,我不想..
@覆盖
在prepared公共无效(MediaPlayer的MP)
{
Toast.makeText(上下文中,prepatre,Toast.LENGTH_LONG).show();
mMediaPlayer.start(); }
I am using listview adapter to displays list of tracks.Each list item has play and stop icons to play and stop track.The issue I am having is that track gets played only once when i first click on play button.After that if i stop it by clicking on stop button and the try to play any track it doesn't get played.Through toast message i found out that holder.img1.setOnClickListener() method does get called but onPrepared() method doesn't get called on clicking on play button for second time or after that..If i replace mMediaPlayer.pause();
by mMediaPlayer.release();
still i get same result..If i put mMediaPlayer=new MediaPlayer();
inside onClick() method of holder.img1.setOnClickListener
above issue does get resolved but then clicking on multiple play buttons will start playing multiple tracks at same time which i don't want..
@Override
public void onPrepared(MediaPlayer mp)
{
Toast.makeText(context,"prepatre",Toast.LENGTH_LONG).show();
mMediaPlayer.start();
}
这篇关于塞顿的MediaPlayer preparedListener不会被要求第二次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!