Skip to content

Commit

Permalink
Ajout de mMediaPlayer.release() pour éviter de crash
Browse files Browse the repository at this point in the history
  • Loading branch information
fcro committed Sep 4, 2016
1 parent b1e4c3d commit 897ef03
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public void onClick(View view) {
}

private void startMusic(int music) {
if (mMediaPlayer != null) {
mMediaPlayer.release(); // on libere l'objet avant d'en instancier un nouveau
}

mMediaPlayer = MediaPlayer.create(this, music);
mMediaPlayer.start();
}
Expand Down

0 comments on commit 897ef03

Please sign in to comment.