Skip to content

Instantly share code, notes, and snippets.

@udacityandroid
Last active May 19, 2023 05:51
Show Gist options
  • Save udacityandroid/f4ec40027031ba7de9352465f143c816 to your computer and use it in GitHub Desktop.
Save udacityandroid/f4ec40027031ba7de9352465f143c816 to your computer and use it in GitHub Desktop.
Miwok app: Cleaning up MediaPlayer resources
/**
* Clean up the media player by releasing its resources.
*/
private void releaseMediaPlayer() {
// If the media player is not null, then it may be currently playing a sound.
if (mMediaPlayer != null) {
// Regardless of the current state of the media player, release its resources
// because we no longer need it.
mMediaPlayer.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.
mMediaPlayer = null;
}
}
@manansood60
Copy link

You got me 👍

@victorcocuz
Copy link

what's with this? this is a reaaaally old udacity nanodegree android app

@JonathanSum
Copy link

JonathanSum commented Apr 1, 2023

image
Time to celebrate🥳🎉🎊🪅

@Vipxpert
Copy link

Heh! You're too early !!

@slxny
Copy link

slxny commented May 19, 2023 via email

@slxny
Copy link

slxny commented May 19, 2023 via email

@slxny
Copy link

slxny commented May 19, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment