final ListView opponentsList = (ListView) view.findViewById(R.id.opponentsList);
ArrayList<Integer> userIds = new ArrayList<>();
QBUsers.getUsersByIDs(userIds, new QBPagedRequestBuilder(userIds.size(), 1), new QBEntityCallbackImpl<ArrayList<QBUser>>() {
@Override
public void onSuccess(ArrayList<QBUser> results, Bundle params) {
super.onSuccess(results,params);
List<QBUser> users = new ArrayList<>(results.size());
for (QBUser result : results)
{
// There mus be a more efficient, or at least better looking, way of doing this...
QBUser user = new QBUser();
user.setId(result.getId());
user.setLogin(result.getFullName());
users.add(user);
}
int i = searchIndexLogginedUser(users);
if (i >= 0)
users.remove(i);
// Prepare users list for simple adapter.
//
opponentsAdapter = new OpponentsAdapter(getActivity(), users);
opponentsList.setAdapter(opponentsAdapter);
}
});
progresDialog.dismiss();
Not going onSuccess method when getting users data from QBUsers.getUsersByIDs() using quickblox example in android?
Its not showing because you are not supplying any value into the query:
ArrayList<Integer> userIds = new ArrayList<>();
You should add an id or several ids to this list before the query can search to see if the user is present and return the QBUser in the onSuccess method. An example of a correct way of doing it is:
ArrayList<Integer> userIds = new ArrayList<>();
userIds.add(123456);
QBUsers.getUsersByIDs(userIds, new QBPagedRequestBuilder(userIds.size(), 1), new QBEntityCallbackImpl<ArrayList<QBUser>>() {
@Override
public void onSuccess(ArrayList<QBUser> results, Bundle params) {
super.onSuccess(results,params);
List<QBUser> users = new ArrayList<>(results.size());
for (QBUser result : results)
{
// There mus be a more efficient, or at least better looking, way of doing this...
QBUser user = new QBUser();
user.setId(result.getId());
user.setLogin(result.getFullName());
users.add(user);
}
int i = searchIndexLogginedUser(users);
if (i >= 0)
users.remove(i);
// Prepare users list for simple adapter.
//
opponentsAdapter = new OpponentsAdapter(getActivity(), users);
opponentsList.setAdapter(opponentsAdapter);
}
});
progresDialog.dismiss();
If there is a user with this id then it will return the user in the onSuccess() method. Hope this helps.