本文整理匯總了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);
}
});
}