我正在使用Android ExoPlayer,我创建了一个名为 SongPlaybackManager.java 的单例类来处理所有播放内容(播放,暂停,下一个,上一个,随机播放,重复播放等)
public class SongPlaybackManager implements Player.EventListener {
private static SongPlaybackManager manager;
private final SimpleExoPlayer player;
private SongPlaybackManager() {
//init player also addListener
...
player.addListener(this);
}
public static SongPlaybackManager getInstance() {
if (manager == null) {
manager = new SongPlaybackManager();
}
return manager;
}
//EventListener callbacks overrides
}
但是我想知道我是否必须删除监听器以防止泄漏内存。有什么建议吗?