How to loop sound in android

后端 未结 2 592
旧时难觅i
旧时难觅i 2021-01-06 09:05

When press button first sound active. Then press that button again it will stop and second sound active My code is OK?

package com.Randomsentence;
    impor         


        
相关标签:
2条回答
  • 2021-01-06 09:36

    Add the line:

    mp.setLooping(true);
    

    Then set false when you want to stop it looping.

    0 讨论(0)
  • 2021-01-06 09:40

    Your code has several errors. Typos, cases,

    ex.: Medaiplayer should be MediaPlayer

    This alone would be enough to cause the error. Also, declaring your variables outside the method is a good idea.

    0 讨论(0)
提交回复
热议问题