Created
May 14, 2016 00:36
-
-
Save udacityandroid/17851f0932e58eed13dc27d8267bc4ea to your computer and use it in GitHub Desktop.
Copy over the releaseMediaPlayer() helper method from the NumbersActivity into the NumbersFragment.
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
/** | |
* 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; | |
// Regardless of whether or not we were granted audio focus, abandon it. This also | |
// unregisters the AudioFocusChangeListener so we don't get anymore callbacks. | |
mAudioManager.abandonAudioFocus(mOnAudioFocusChangeListener); | |
} | |
} |
... and a little nerve wrecking.... =)
more specific instruction pls, how can i know where to past the code????
more specific instruction pls, how can i know where to past the code????
paste after this line
@OverRide
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
TextView textView = new TextView ( getActivity () );
textView.setText ( R.string.hello_blank_fragment );
return textView;
}
Hello 2020
Having Less Hand Holding
But I will Manage it! 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's really exciting and interesting!!!