Android-mediaplayer stop and start
Ngày đăng:
01/01/2022
Trả lời:
0
Lượt xem:
63
I'm creating Android application contains 2 buttons, on click on each button play a mp3 file. The problem is when I play button1 it plays sound1, when I click button2 it plays sound2. I check on each button the other player if it's working and I stop it and play the clicked one But If I click on same button twice it's keep first audio playing in the background and play another one again I tried to check isPlaying() and to stop it, but it doesn't work! I want If I click on button1 it play sound1 and if clicked on it again it stop it and play it again from beginning. My code: Hope if there any better code that can use multiple buttons as an array or something to not check each button and player every time. Question&Answers:os与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视 |