gpt4 book ai didi

android - 未从 quickblox 示例获取用户列表信息

转载 作者:行者123 更新时间:2023-11-29 00:04:16 26 4
gpt4 key购买 nike

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();

在 android 中使用 quickblox 示例从 QBUsers.getUsersByIDs() 获取用户数据时没有继续 onSuccess 方法?

最佳答案

它没有显示,因为您没有向查询提供任何值:

ArrayList<Integer> userIds = new ArrayList<>();

在查询可以搜索以查看用户是否存在并在 onSuccess 方法中返回 QBUser 之前,您应该向此列表添加一个或多个 ID。正确做法的一个例子是:

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();

如果有这个id的用户,那么它会在onSuccess()方法中返回这个用户。希望这会有所帮助。

关于android - 未从 quickblox 示例获取用户列表信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35199641/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com