Skip to content Skip to sidebar Skip to footer

Java.lang.exceptionininitializererror In Enum With Multiple Values

This is the code of enum (inside of singleton class): public class GlobalStore extends Application{ ..... ...... ..... public synchronized static GlobalStore getInstance() { if

Solution 1:

I believe your code here:

Category(int mId, String mGloss, String mCode) {
        this.id = mId;
        this.gloss = mGloss;
        this.code = mCode;
    }

expects three values to be initialised. But this line :

publicstatic Category findCategoryById(int mId)

is initialising just one out of those. In that static context all the parameters needs to be initialised.

Solution 2:

The problem was CATEGORIA_XX(N,instance.getString(R.string.cat_mmm),"YY")

getString activity needs to interpret the getString.

CATEGORIA_XX(N,ActivityInstance.getString(R.string.cat_mmm),"YY")

It's Works well!.

Many thanks to all.

Post a Comment for "Java.lang.exceptionininitializererror In Enum With Multiple Values"