Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copy over the releaseMediaPlayer() helper method from the NumbersActivity into the NumbersFragment.
/**
* 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);
}
}
@virtualdesigner

This comment has been minimized.

Copy link

@virtualdesigner virtualdesigner commented Jan 25, 2018

It's really exciting and interesting!!!

@biddlecom

This comment has been minimized.

Copy link

@biddlecom biddlecom commented Jun 30, 2018

... and a little nerve wrecking.... =)

@AndiHoxha1987

This comment has been minimized.

Copy link

@AndiHoxha1987 AndiHoxha1987 commented Oct 8, 2019

more specific instruction pls, how can i know where to past the code????

@xMagicXs

This comment has been minimized.

Copy link

@xMagicXs xMagicXs commented Oct 25, 2019

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;
}

@rajhritik

This comment has been minimized.

Copy link

@rajhritik rajhritik commented Dec 31, 2019

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