开发者

direct Global viable access using an "Application" class?

开发者 https://www.devze.com 2023-03-06 21:06 出处:网络
i want to setup a global variable class holder extending \"Application\" like this one here: http://trace.adityalesmana.com/2010开发者_高级运维/08/declare-global-variable-in-android-via-android-app-a

i want to setup a global variable class holder extending "Application" like this one here:

http://trace.adityalesmana.com/2010开发者_高级运维/08/declare-global-variable-in-android-via-android-app-application/

my question is it possible to access the viable directly instead of calling a method?

(going by the link's example) can "islogin" be declared as:

public boolean isLogin = true;

then accessed like this?:

if (!combankDroid.isLogin) {


You can do what you want: global variables on Application objects work just fine.

The actual solution to your issue is to make the MediaPlayer instance a variable of a Service and then connect to that to fetch/control the MediaPlayer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号