java - Is setting Android MediaPlayer player to null when releasing necessary? -


looking @ example on how release android mediaplayer instance on official document, says should nullify object after releasing it:

here's how should release , nullify mediaplayer:

mediaplayer.release(); mediaplayer = null; // <-- instruction asking about. 

is necessary? if so, why?

source: https://developer.android.com/guide/topics/media/mediaplayer.html#releaseplayer

the null mark gc can 'collect' object.


Comments

Popular posts from this blog

javascript - How to diff two immutable objects -

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

javascript - React.js: onClick function from child to parent -