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

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -