本文整理汇总了Java中cn.bmob.v3.BmobQuery.findObjects方法的典型用法代码示例。如果您正苦于以下问题:Java BmobQuery.findObjects方法的具体用法?Java BmobQuery.findObjects怎么用?Java BmobQuery.findObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.bmob.v3.BmobQuery
的用法示例。
在下文中一共展示了BmobQuery.findObjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPostComment
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
* 获取文章的评论
*/
public void getPostComment(String postId, final RequestListener<List<Comment>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Comment> query = new BmobQuery<>();
Post post = new Post();
post.setObjectId(postId);
query.addWhereEqualTo("post", new BmobPointer(post));
query.include("user");
query.order("-createdAt");
query.findObjects(new FindListener<Comment>() {
@Override
public void done(List<Comment> list, BmobException e) {
if (e == null) {
listener.success(list);
}
}
});
}
示例2: queryUserInfo
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
* 查询指定用户信息
*
* @param objectId
* @param listener
*/
public static void queryUserInfo(String objectId, final BmobEvent.QueryUserListener listener) {
BmobQuery<User> query = new BmobQuery<>();
query.addWhereEqualTo("objectId", objectId);
query.findObjects(
new FindListener<User>() {
@Override
public void done(List<User> list, BmobException e) {
if (e == null) {
if (list != null && list.size() > 0) {
listener.done(list.get(0), null);
} else {
listener.done(null, new BmobException(000, "查无此人"));
}
} else {
listener.done(null, e);
}
}
});
}
示例3: startSearchUser
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void startSearchUser(final String username, final String password) {
BmobQuery<UserLogin> query = new BmobQuery<>();
query.addWhereEqualTo("username", username);
query.setLimit(1);
query.findObjects(new FindListener<UserLogin>() {
@Override
public void done(List<UserLogin> list, BmobException e) {
if (e == null && !list.isEmpty()) {
startLogin(list.get(0));
} else if (e == null) {
startRegister(username, password);
} else {
showNormalDia("温馨提示", "登录失败!请检查网络连接");
Log.e(TAG, "query.findObjects: ", e);
}
}
});
}
示例4: refresh
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
public void refresh() {
BmobQuery<Order> queryData = new BmobQuery<Order>();
queryData.setLimit(15);
queryData.include("user");
queryData.findObjects(getActivity(), new FindListener<Order>() {
@Override
public void onSuccess(List<Order> list) {
if (list != null) {
mLists.clear();
mLists.addAll(list);
Toast.makeText(getActivity(), "刷新成功", Toast.LENGTH_SHORT).show();
myItemAdapter.updateItems(mLists);
refreshLayout.setRefreshing(false);
}
}
@Override
public void onError(int i, String s) {
Toast.makeText(getActivity(), "网络出错", Toast.LENGTH_SHORT).show();
refreshLayout.setRefreshing(false);
}
});
}
示例5: queryBlackList
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
* 查询黑名单用户
*
* @param callback 回调
*/
private void queryBlackList(final FindListener<User> callback) {
BmobQuery<User> query = new BmobQuery<>();
query.order("updateAt");
query.addWhereRelatedTo(COLUMN_NAME_BLACKLIST, new BmobPointer(getCurrentUser()));
query.findObjects(CustomApplication.getInstance(), new FindListener<User>() {
@Override
public void onSuccess(List<User> list) {
callback.onSuccess(list);
}
@Override
public void onError(int i, String s) {
callback.onError(i, s);
}
}
);
}
示例6: queryJoinedUser
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void queryJoinedUser() {
BmobQuery<User> query = new BmobQuery<>();
query.addWhereRelatedTo("join", new BmobPointer(mActivity));
query.findObjects(new FindListener<User>() {
@Override
public void done(List<User> list, BmobException e) {
if (e == null) {
if (list.size() > 0) {
if (users != null) {
users.clear();
}
users.addAll(list);
adapter.notifyDataSetChanged();
// 并设置人数
joinedNum.setText(list.size() + "");
} else {
showToast("服务器没有数据");
}
swipeRefreshLayout.setRefreshing(false);
} else {
showToast("访问服务器失败,稍后重试" + e.getMessage() + e.getErrorCode());
swipeRefreshLayout.setRefreshing(false);
}
}
});
}
示例7: pullReleasePost
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
* 获取该用户发布的帖子
*
* @param currentIndex
* @param size
* @param listener
*/
public void pullReleasePost(String userId, int currentIndex, int size, final RequestListener<List<Post>> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
query.addWhereEqualTo("author", userId); // 查询当前用户的所有帖子
query.setSkip(currentIndex);
query.setLimit(size);
query.order("-updatedAt");
query.include("author");// 希望在查询帖子信息的同时也把发布人的信息查询出来
query.findObjects(new FindListener<Post>() {
@Override
public void done(List<Post> list, BmobException e) {
if (e == null) {
listener.success(list);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例8: cheackUser
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void cheackUser() {
BmobQuery<MyUser> query = new BmobQuery<MyUser>();
query.addWhereEqualTo("username", "182****2002");
query.setLimit(1);
query.findObjects(new FindListener<MyUser>() {
@Override
public void done(List<MyUser> list, BmobException e) {
if (e == null) {
if (list.size() > 0 && list != null) {
Log.d(TAG, "cheackUser: ok");
} else {
Log.d(TAG, "cheackUser: not");
}
} else {
Log.d(TAG, "done: " + e);
}
}
});
}
示例9: putToRefreshByUnit
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
* “单元”列表下拉刷新具体实现
*/
private void putToRefreshByUnit() {
//初始化Bmob查询类
BmobQuery<Unit> query = new BmobQuery<>();
//执行查询,查询单元表 取出所有单元
query.findObjects(getContext(), new FindListener<Unit>() {
@Override
public void onSuccess(final List<Unit> unitList) {
//根据查询的所有单元,请求所有的知识点数据
requestPointByUnits(unitList);
}
@Override
public void onError(int i, String s) {
toastError(mLoadingLayout, getContext());
}
});
}
示例10: synvToDb
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
public void synvToDb() {
BmobQuery<Note> query = new BmobQuery<Note>();
query.addWhereEqualTo("userObjId", BmobUser.getCurrentUser().getUsername());
query.setLimit(50); //查询本用户的50条笔记
query.findObjects(new FindListener<Note>() {
@Override
public void done(List<Note> list, BmobException e) {
if (e == null) {
Logger.d("共查询到:" + list.size());
for (Note note : list) {
NoteEntity entity = note.toEntity();
entity.setObjId(note.getObjectId());
CloudNoteApp.getNoteEntityDao().insertOrReplace(entity);
}
NotesFromDatabaseObservable.ofDate()
.subscribe(NoteFragment.this);
} else {
Logger.d("bmob查询失败:" + e.getMessage() + "," + e.getErrorCode());
}
}
});
}
示例11: showCommentMessage
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void showCommentMessage(final PushMessage msg) {
BmobQuery<Comment> query=new BmobQuery<Comment>();
query.addWhereEqualTo("objectId", msg.alert);
query.findObjects(context, new FindListener<Comment>() {
@Override
public void onSuccess(List<Comment> list) {
if(list.size()>0){
Comment comment=list.get(0);
Log.d("BB",comment.getContent());
if(application.isCommentAllowed)
{
showNotification(context, comment,msg.tag);
}
}
}
@Override
public void onError(int i, String s) {
}
});
}
示例12: queryCurrentOrderFromBmob
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
/**
*
*/
private void queryCurrentOrderFromBmob() {
BmobQuery<Order> bmobQuery = new BmobQuery<>();
bmobQuery.addWhereEqualTo("objectId", order.getObjectId());
bmobQuery.findObjects(new FindListener<Order>() {
@Override public void done(List<Order> list, BmobException e) {
if (e != null) {
toastUtil.show(e.getMessage());
return;
}
if (list.size() > 0) {
order = list.get(0);
initOrder(order);
}
}
});
}
示例13: findAllMoments
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
public void findAllMoments(final SimpleResponseListener simpleResponseListener) {
BmobQuery<MomentsInfo> momentQuery = new BmobQuery<>();
momentQuery.order("-createdAt");
momentQuery.findObjects(new FindListener<MomentsInfo>() {
@Override
public void done(List<MomentsInfo> list, BmobException e) {
if (e == null) {
if (momentsList == null) {
momentsList = new ArrayList<MomentsInfo>();
}
momentsList.clear();
momentsList.addAll(list);
if (simpleResponseListener != null) {
simpleResponseListener.onSuccess("成功", 0);
}
}
}
});
}
示例14: getWelcomePic
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
public void getWelcomePic(final WelcomeActivity context) {
BmobQuery<Wel> bmobQuery = new BmobQuery<>();
bmobQuery.addWhereEqualTo("imgDate", OtherUtils.currDay());
bmobQuery.findObjects(new FindListener<Wel>() {
@Override
public void done(List<Wel> list, BmobException e) {
if (list == null) {
return;
}
LogUtil.e3("list.size() = " + list.size());
for (int i = 0; i < list.size(); i++) {
LogUtil.e3(list.get(i).toString());
break;
}
}
});
}
示例15: findThisBook
import cn.bmob.v3.BmobQuery; //导入方法依赖的package包/类
private void findThisBook()
{
BmobQuery<Book> query1 = new BmobQuery<Book>();
query1.addWhereEqualTo("name", books.getName());
query1.addWhereEqualTo("autor", books.getAutor());
query1.findObjects(AddBook.this, new FindListener<Book>() {
@Override
public void onSuccess(List<Book> object) {
// TODO Auto-generated method stub
//toast("查询成功:共"+object.size()+"条数据。");
bookId = object.get(0).getObjectId();
Toast.makeText(AddBook.this, bookId+"", Toast.LENGTH_SHORT).show();
//添加记录
RecordBook recordBook = new RecordBook(new BmobDate(new Date()), "录入", mUser.getAddrs()+" "+mUser.getUsername(),bookId);
AddBookRecordUtil.addTherecord(AddBook.this, recordBook);
}
@Override
public void onError(int code, String msg) {
// TODO Auto-generated method stub
// toast("查询失败:"+msg);
}
});
}