I get a NullPointerException calling a Superclass Method in Subclass Inner Class Constructor... What's the Deal?
In my application's main class (subclass of Application), I have a public inner class that simply contains 3 public string objects. In the parent class I declare an object of that inner class.
public class MainApplication extends Application {
public class Data {
public String x;
public String y;
public String z;
}
private Data data;
MainApplication() {
data = new Data()
data.x = SuperClassMethod();
}
}
After I instantiate the object in the constructor, I get a runtime error when I try to assign a value in the inner class with a superclass method.
Any idea what's up here?? Can you not call superclass methods in the subclass constructor?
** Edit ** Original question was about inner class member assignment in outer class constructor. Turned out the issue was with calling a superclass method in the class's constructor. It was giving me a null pointer exception. Thus, the question has changed.