Save array in model?

107 views Asked by At

I wanted to simply save an array of Strings in a model and later change it's value, but somehow the framework throws a nullpointer exception?
So how can I use an array in a model?

public String[] workinghours = new String[10];

Thats how I initialize the array.

for (int i = 0; i < 5; i++) {
            this.workinghours[i] = ("8-18");
}

And thats how I want to change the value later in a method. But then I get an exception:

[NullPointerException: null]

But my array cannot be null?

0

There are 0 answers