Question

I have a function to return an arraylist;

public ArrayList sendUpdatedList()
{
    return connections;
}

this is how im calling it, from a different class;

connections = client.sendUpdatedList();

Its producing a nullpointererror. "connections" is set further up in the class and initialized. help!

Was it helpful?

Solution

Since the only actual access to a reference here is client, then in here the problem is client is null.

Your stacktrace could actually have shown you that the method you thought is responsible, is not actually called.

As a side note, you should avoid using raw types (ArrayList), and try to stick with generics (ArrayList<SomeClass>).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top