0

Hi i have again a Problem,

my app plays sound 1 sec. this work fine but if i press less 20 time on any button then plays nothing more what is the error? How i can fix it?

    tsc = (Button) findViewById(R.id.button12);
tsc.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
playSound(R.raw.en_bye);


}
    private void playSound(int sFile) {
    // set up MediaPlayer
    final int medFile = sFile;

    Thread thread = new Thread(new Runnable() {

        public void run() {
            mp = MediaPlayer.create(getApplicationContext(), medFile);
            mp.start();
        }
    });
    thread.start();
}

Thank you

nitind
  • 19,089
  • 4
  • 34
  • 43
elHomer
  • 48
  • 2
  • 10
  • 1
    You're running out of AudioTracks, see here: http://stackoverflow.com/questions/20889627/playing-repeated-audiotrack-in-android-activity/20890423#20890423 – Melquiades Jan 23 '14 at 12:11
  • Okay thank you now works fine xD its a litle simple code thanks! – elHomer Jan 23 '14 at 12:21

0 Answers0