I think I understood your problem now. You have a inner class A
declared inside your class MainActivity
, right? Well, in this case you wont be able to initialize your static final
variables since you gonna need an instance of MainActivity
to create a new instance of A
. What I suggest you to do is to make your class A
a static class
private static class A {
// code here
}
so that you will be able to instantiate as
A a = new MainActivity.A("someString");
and the variables initialization as
private static final A[] aList;
static {
a = new A[2];
a[0] = new MainActivity.A("emails");
}