Ok so now I have Class A
that contains some spinners that values will be populated by Class B
that extends AsnycTask
which grabs the spinner values from a web service. In class B i manage to retrieve the values, showing in a Toast. The problem now is how do I pass those spinner values back to Class A?
I've tried
Can OnPostExcecute method in AsyncTask RETURN values?
by passing Class A
to Class B
and store the value in a public variable of Class A
like below
@Override
protected void onPostExecute(String result)
{
classA.classAvariable = result;
}
However whenever I try to read the classAvariable
i always get a NullPointer Exception
.
Seems like the variable was never assigned with the result.
For readability purpose I needed to seperate Class B
instead of using as an inline class.
Any ideas my fellow Java programmers?