I have several raw sound files that I want to play using the MediaPlayer class in the android API, before I change the data source to a different file do I have to call release(); The documentation says that the release(); method will end the MediaPlayer object, I am using the same MediaPlayer object to switch between the different raw files so will that interfere, or do I just call release after the program ends
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Call reset()
first. It resets the MediaPlayer to its uninitialized state. Then you will have to initialize it again by setting the data source and calling prepare()
. Call release()
once you are done with the MediaPlayer instance.