Skip to content Skip to sidebar Skip to footer

Issue With Static Code In Android

I am building my own class, which is similar to an Enum. Here's the code: public final class MyClass { public final static MyClass V1 = new MyClass('v1'); public final stat

Solution 1:

Currently, the best way I found to tackle the issue is to move values definition and initialization before the other static variables. This way, it gets initialized before the constructors are invoked.

Look at this: Static initializer not called on Activity creation

Post a Comment for "Issue With Static Code In Android"