Pregunta

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!

¿Fue útil?

Solución

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>).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top