Android static variables are lost

前端 未结 3 1737
粉色の甜心
粉色の甜心 2021-01-19 01:46

I am using a class with only static variables to store all constants and run-time properties. But, recently I have seen instances when I\'m referencing these variables, I ge

3条回答
  •  轮回少年
    2021-01-19 02:10

    androidId is a reference to an string, string is a class that will get by default a null reference as intial value if you dont do it....

    look at this taken from oracle's doc

    So basically androidId is null because is not initialized....the fact that the variable is static or not is not relevant in this case...

    see here for more details

    ...I SOMETIMES get null.

    yes, you will get always null unless its value change at run time...

提交回复
热议问题