I am looking to get the names of a few users from the parse.com DB based on a few queries, for which I am using a for loop to get users and load it into a listview using a custom adapter and the code I have used is as under :
query.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> pusers, ParseException e) {
// TODO Auto-generated method stub
if (e==null) {
for (ParseUser pu : pusers) {
Users1[] data = new Users1[] {
new Users1(pu.getString("Name"), true)
};
}
UserListAdapter mUserAdapter = new UserListAdapter(getBaseContext(), R.layout.user_list_item, data);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(ManualInviteActivity.this);
builder.setMessage(R.string.login_error_message);
builder.setTitle(R.string.login_error_title);
builder.setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.create();
dialog.show();
}
}
});
I am getting an error when I try to initialize the adapter at 'data' which says that data cannot be resolved to a variable, when I have created it already. How do I fix this? Thanks