简体   繁体   English

替代静态方法

[英]Alternative to static methods

I have a MediaPlayerService class with player methods and a "NowPlaying" Activity , i want to update the process , and best way for get player information ("getCurrentPosition" etc) is "static methods" and this Consumes a lot of battery power . 我有一个带有播放器方法和“ NowPlaying”活动的MediaPlayerService类,我想更新该过程,获取播放器信息(“ getCurrentPosition”等)的最佳方法是“静态方法”,这会消耗大量电池电量。

I want to update the process and save the battery , there is an Alternative to update process without static methods ? 我想更新过程并节省电池,有没有静态方法的更新过程吗?

Sorry for my bad eng . 对不起,我不好意思。

Static method may lead to memory leak but its not bad for battery. 静态方法可能会导致内存泄漏,但对电池而言还不错。 You can track any memory leak in your application by using this library( github.com/square ) 您可以使用此库来跟踪应用程序中的任何内存泄漏( github.com/square

If you want to use something else try BroadcastReceiver. 如果要使用其他功能,请尝试使用BroadcastReceiver。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM