if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.reset();
mediaPlayer.release();
}
mediaPlayer = MediaPlayer.create(context, songs[position]);
mediaPlayer.start();var mediaPlayer=MediaPlayer()
var ber=true
var sed=my_view.btn_all
my_view.btn_all.setOnClickListener {
if (mediaPlayer.isPlaying){
mediaPlayer.pause()
}
if (ber){
mediaPlayer.reset()
mediaPlayer = MediaPlayer.create(context, songs[position])
mediaPlayer.start()
ber=!ber
sed.btn_all.setImageResource(R.drawable.ic_baseline_pause_24)
}else if (!ber){
mediaPlayer.pause()
ber=!ber
sed.btn_all.setImageResource(R.drawable.ic_baseline_play_arrow_24)
}
}
هل يمكنك مساعدتي عل تحديد مكان وضع الrelease
@Mohamd Imran
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.reset();
mediaPlayer.release();
}
mediaPlayer = MediaPlayer.create(context, songs[position]);
mediaPlayer.start();var mediaPlayer=MediaPlayer()
var ber=true
var sed=my_view.btn_all
my_view.btn_all.setOnClickListener {
if (ber){
mediaPlayer.reset()
mediaPlayer = MediaPlayer.create(context, songs[position])
mediaPlayer.start()
ber=!ber
sed.btn_all.setImageResource(R.drawable.ic_baseline_pause_24)
}else if (!ber){
mediaPlayer.pause()
ber=!ber
sed.btn_all.setImageResource(R.drawable.ic_baseline_play_arrow_24)
}
}
هل يمكنك مساعدتي على تحديد مكان وضع الكود
@Mohamd Imran