I am, however, using RingtoneManager
to get Ringtone
s.
This information is already contained in this question and answer , but Googlers are not likely to find it unless they already know what to search for (at least I could not).
It's because RingtoneManager.getRingtone()
internally calls open()
on the returned Ringtone
object. Ringtone.open()
sets up a MediaPlayer
, and this MediaPlayer
does not get released unless you manually call Ringtone.stop()
. Note that you do not need to actually play the ringtone for this to be true . This does not appear to be documented anywhere.
I don't know how much actual harm there is in neglecting to release a MediaPlayer
(the documentation provides a worst-case scenario), but manually calling stop()
on your Ringtone
s before letting them get GC'ed will at least silence the warning.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.