forked from udacity/ud839_Miwok
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added media player to play sound for options with async
- Loading branch information
Showing
6 changed files
with
167 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.android.miwok; | ||
|
||
import android.media.MediaPlayer; | ||
|
||
/** | ||
* Created by User on 25/03/2018. | ||
*/ | ||
|
||
public final class Helper { | ||
public static void release(MediaPlayer mediaPlayer) { | ||
/** | ||
* Clean up the media player by releasing its resources. | ||
*/ | ||
// If the media player is not null, then it may be currently playing a sound. | ||
if (mediaPlayer != null) { | ||
// Regardless of the current state of the media player, release its resources | ||
// because we no longer need it. | ||
mediaPlayer.release(); | ||
|
||
// Set the media player back to null. For our code, we've decided that | ||
// setting the media player to null is an easy way to tell that the media player | ||
// is not configured to play an audio file at the moment. | ||
mediaPlayer = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters