Hi dear Backendless!
getting the dreaded : “NullPointerException: Attempt to invoke virtual method ‘boolean java.util.ArrayList.add(java.lang.Object)’ on a null object reference”
in a situation in which i’m not sure what the problem is:
Backendless.Persistence.of(BackendlessUser.class).find(dataQuery, new AsyncCallback<BackendlessCollection<BackendlessUser>>() {
@Override
public void handleResponse(BackendlessCollection<BackendlessUser> foundUsers) {
// all Contact instances have been found
for (int i = 0; i < foundUsers.getTotalObjects(); i++) {
// Create a new object for each list item
ru = foundUsers.getCurrentPage().get(i);
Log.i("objectid", ru.getObjectId());
newfollowinglist.add(ru);
I’m sure that it should have worked, because “ru” is a Backendlessuser and “newfollowinglist” is an ArrayList of Backendlessuser, and because I do get the users’ ObjectId in the Log.i in the logcat.
this is how I’ve defined newfollowinglist and ru:
static ArrayList<BackendlessUser> newfollowinglist;
BackendlessUser ru = new BackendlessUser();please help,Gil.