Java Code Examples for cn.bmob.v3.BmobQuery#order()
The following examples show how to use
cn.bmob.v3.BmobQuery#order() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SampleAdapter.java From styT with Apache License 2.0 | 6 votes |
@Override protected void onBindItemViewHolder(ItemViewHolder holder, final int headerPosition, final int itemPosition) { final Comment weibo = weibos.get(itemPosition); MyUser user = BmobUser.getCurrentUser(MyUser.class); BmobQuery<Comment> query = new BmobQuery<>(); //query.addWhereEqualTo("author", user); // 查询当前用户的所有微博 query.order("-updatedAt"); query.include("author");// 希望在查询微博信息的同时也把发布人的信息查询出来,可以使用include方法 query.setLimit(4); query.findObjects(new FindListener<Comment>() { @Override public void done(List<Comment> object, BmobException e) { if (e == null) { weibos = object; adapter.notifyDataSetChanged(); } else { } } }); //adapter = new MyAdapter(getActivity()); holder.listView.setAdapter(adapter); }
Example 2
Source File: OwnChannelFragment.java From VSigner with GNU General Public License v2.0 | 6 votes |
public void refreshData() { BmobQuery<Channel> channelQuery = new BmobQuery<Channel>(); channelQuery.addWhereEqualTo(Channel.MANAGER_KEY, mCurrentUser.getObjectId()); channelQuery.include(Channel.MANAGER_KEY); channelQuery.setLimit(Constants.QUERY_MAX_NUMBER); channelQuery.order("-" + Channel.IS_ACTIVE_KEY + ",-" + Constants.UPDATED_AT_KEY); channelQuery.findObjects(mContext, new FindListener<Channel>() { @Override public void onSuccess(List<Channel> channels) { mOwnChannelAdapter.clear(); mOwnChannelAdapter.addAll(channels); mPullToRefreshLayout.refreshFinish(PullToRefreshLayout.SUCCEED); } @Override public void onError(int arg0, String msg) { mPullToRefreshLayout.refreshFinish(PullToRefreshLayout.FAIL); } }); }
Example 3
Source File: SettingsActivity.java From Mobike with Apache License 2.0 | 6 votes |
private void findNew() { mDialog.show(); BmobQuery<VersionInfo> query = new BmobQuery<>("VersionInfo"); query.order("-updatedAt"); query.setLimit(1);//最新1条 query.findObjects(new FindListener<VersionInfo>() { @Override public void done(List<VersionInfo> list, BmobException e) { if (e == null && !list.isEmpty()) { dismissDialog(); chackVersion(list.get(0)); } else { ToastUtils.show(SettingsActivity.this, "检查新版本失败"); Logger.d(e); } dismissDialog(); } }); }
Example 4
Source File: ShareInfoPresenter.java From NewFastFrame with Apache License 2.0 | 6 votes |
public void getFirstPostNotifyBean() { BmobQuery<PostNotifyBean> bmobQuery = new BmobQuery<>(); bmobQuery.addWhereEqualTo("toUser", new BmobPointer(UserManager.getInstance().getCurrentUser())); bmobQuery.addWhereEqualTo("readStatus", ConstantUtil.READ_STATUS_READED); bmobQuery.order("-createdAt"); bmobQuery.setLimit(1); bmobQuery.include("relatedUser"); addSubscription(bmobQuery.findObjects(new FindListener<PostNotifyBean>() { @Override public void done(List<PostNotifyBean> list, BmobException e) { if (e == null && list != null && list.size() > 0) { RxBusManager.getInstance().post(new UnReadPostNotifyEvent(list.get(0))); } } })); }
Example 5
Source File: LoginF.java From stynico with MIT License | 6 votes |
private void findWeibos() { //MyUser user = BmobUser.getCurrentUser(LoginF.this, MyUser.class); BmobQuery<Login> query = new BmobQuery<Login>(); //query.addWhereEqualTo("author", user); // 查询当前用户的所有微博 query.order("-updatedAt"); query.include("author");// 希望在查询微博信息的同时也把发布人的信息查询出来,可以使用include方法 query.findObjects(LoginF.this, new FindListener<Login>() { @Override public void onSuccess(List<Login> object) { // TODO Auto-generated method stub weibos = object; adapter.notifyDataSetChanged(); // mProgressDialog.dismiss(); } @Override public void onError(int code, String msg) { // TODO Auto-generated method stub // toast("查询失败:" + msg); } }); //mProgressDialog = ProgressDialog.show(getActivity(), null, getResources().getString(R.string.del_)); }
Example 6
Source File: WeiboListActivity.java From stynico with MIT License | 6 votes |
private void findWeibos_() { nico.styTool.MyUser user = BmobUser.getCurrentUser(this, nico.styTool.MyUser.class); BmobQuery<Post_> query = new BmobQuery<Post_>(); query.addWhereEqualTo("author", user); // 查询当前用户的所有微博 query.order("-updatedAt"); query.include("author");// 希望在查询微博信息的同时也把发布人的信息查询出来,可以使用include方法 query.findObjects(this, new FindListener<Post_>() { @Override public void onSuccess(List<Post_> object) { // TODO Auto-generated method stub weibos = object; adapter.notifyDataSetChanged(); //et_content.setText(""); } @Override public void onError(int code, String msg) { // TODO Auto-generated method stub //toast("查询失败:"+msg); } }); }
Example 7
Source File: RechargeHistoryActivity.java From Mobike with Apache License 2.0 | 6 votes |
private void requestData() { BmobQuery<RechargeHistoryData> query = new BmobQuery<>("RechargeHistoryData"); query.order("-updatedAt"); query.addWhereEqualTo("mMyUser", MyApplication.getInstance().getUser().getObjectId()); //query.setLimit(4);//最新四条活动信息 if (isFirstin) { mDialog.show(); isFirstin = false; } query.findObjects(new FindListener<RechargeHistoryData>() { @Override public void done(List<RechargeHistoryData> list, BmobException e) { if (e == null) { mDatas = list; showHistory(); } else { ToastUtils.show(RechargeHistoryActivity.this, "暂时没有消息"); Logger.d(e); } dismissMyDialog(); } }); }
Example 8
Source File: UserManager.java From TestChat with Apache License 2.0 | 6 votes |
/** * 查询黑名单用户 * * @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); } } ); }
Example 9
Source File: SkinEngine.java From styT with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); et_content = (EditText) findViewById(R.id.et_content); listView = (ListView) findViewById(R.id.lv_feedbacks); emptyView = new TextView(this); emptyView.setText("っ没有数据"); emptyView.setGravity(Gravity.CENTER); emptyView.setTextSize(15); //设置字体大小 LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); addContentView(emptyView, params); listView.setEmptyView(emptyView); BmobQuery<xp> query = new BmobQuery<xp>(); query.order("-createdAt"); query.findObjects(new FindListener<xp>() { @Override public void done(List<xp> object, BmobException e) { if (e == null) { adapter = new FeedbackAdapter(SkinEngine.this, object); listView.setAdapter(adapter); } else { emptyView.setText((CharSequence) object); } } }); }
Example 10
Source File: ProfileActivity.java From ZhihuDaily with MIT License | 5 votes |
private void loadMoreData() { BmobQuery<DailyStory> query = new BmobQuery<>(); query.setLimit(pagesize); query.setSkip(pageindex * pagesize); query.order("-createdAt"); query.addWhereEqualTo("user", ZhihuApplication.user.getObjectId()); query.findObjects(getApplicationContext(), new FindListener<DailyStory>() { @Override public void onSuccess(List<DailyStory> list) { if (list != null && list.size() > 0) { // 数据去重 LinkedHashSet<DailyStory> set = new LinkedHashSet<>(list); List<DailyStory> dailyStoryList = new ArrayList<>(set); mAdapter.addData(dailyStoryList); pageindex++; isLoading = false; if (list.size() < pagesize) { mAdapter.setIsFooterGone(true); } } } @Override public void onError(int i, String s) { } }); }
Example 11
Source File: SkinListPresenter.java From NewFastFrame with Apache License 2.0 | 5 votes |
public void getSkinData(boolean isRefresh) { if (isRefresh) { iView.showLoading(null); page=0; } page++; BmobQuery<SkinBean> skinBeanBmobQuery=new BmobQuery<>(); skinBeanBmobQuery.setLimit(10); skinBeanBmobQuery.setSkip((page-1)*10); skinBeanBmobQuery.order("-createdAt"); addSubscription(skinBeanBmobQuery.findObjects(new FindListener<SkinBean>() { @Override public void done(List<SkinBean> list, BmobException e) { List<SkinEntity> skinEntityList=null; if (e == null) { if (list != null && list.size() > 0) { skinEntityList=new ArrayList<>(); for (SkinBean bean : list) { skinEntityList.add(MsgManager.getInstance().cover(bean)); } } }else { page--; ToastUtils.showShortToast("缓存数据获取"); CommonLogger.e("查询服务器上皮肤数据出错"+e.toString()); if (isRefresh) { skinEntityList= UserDBManager .getInstance().getSkinList(); } } iView.updateData(skinEntityList); iView.hideLoading(); } })); }
Example 12
Source File: SystemNotifyPresenter.java From NewFastFrame with Apache License 2.0 | 5 votes |
public void getAllSystemNotifyData(final boolean isRefresh, final String time) { if (isRefresh) { iView.showLoading(null); } BmobQuery<SystemNotifyBean> bmobQuery = new BmobQuery<>(); BmobDate bmobDate = new BmobDate(new Date(TimeUtil.getTime(time, "yyyy-MM-dd HH:mm:ss"))); bmobQuery.addWhereGreaterThan("createdAt", bmobDate); bmobQuery.order("-createdAt"); addSubscription(bmobQuery.findObjects(new FindListener<SystemNotifyBean>() { @Override public void done(List<SystemNotifyBean> list, BmobException e) { if (e == null) { iView.updateData(list); if (list != null && list.size() > 0) { List<SystemNotifyEntity> list1 = new ArrayList<>(); for (SystemNotifyBean item : list) { SystemNotifyEntity entity = new SystemNotifyEntity(); entity.setId(item.getObjectId()); entity.setContentUrl(item.getContentUrl()); entity.setImageUrl(item.getImageUrl()); entity.setReadStatus(item.getReadStatus()); entity.setSubTitle(item.getSubTitle()); entity.setTitle(item.getTitle()); if (!list1.contains(entity)) { list1.add(entity); } } UserDBManager.getInstance().addOrUpdateSystemNotify(list1); } iView.hideLoading(); } else { iView.showError(e.toString(), () -> getAllSystemNotifyData(isRefresh, time)); } } })); }
Example 13
Source File: FindNotesAty.java From myapplication with Apache License 2.0 | 5 votes |
private void generateDatas() { String currentUserNameStr = (String) BmobUser.getObjectByKey("username"); Log.i(TAG, "currentUserNameStr >> " + currentUserNameStr); BmobQuery<NotesBean> query1 = new BmobQuery<>(); query1.addWhereLessThanOrEqualTo("createdAt", new BmobDate(new Date())); BmobQuery<NotesBean> query2 = new BmobQuery<>(); query2.addWhereEqualTo("userNameStr", currentUserNameStr); List<BmobQuery<NotesBean>> andQuerys = new ArrayList<>(); andQuerys.add(query1); andQuerys.add(query2); BmobQuery<NotesBean> notesInfoBmobQuery = new BmobQuery<>(); notesInfoBmobQuery.and(andQuerys); notesInfoBmobQuery.order("-createdAt"); // 按时间降序排列 // 设定查询缓存策略-CACHE_ELSE_NETWORK: 先从缓存读取数据, 如果没有, 再从网络获取. notesInfoBmobQuery.setCachePolicy(BmobQuery.CachePolicy.CACHE_ELSE_NETWORK); notesInfoBmobQuery.setMaxCacheAge(TimeUnit.DAYS.toMillis(7)); //此表示缓存一天 notesInfoBmobQuery.findObjects(new FindListener<NotesBean>() { @Override public void done(List<NotesBean> list, BmobException e) { if (!list.isEmpty()) { for (NotesBean notesBean : list) { mDatas.add(notesBean); } if (!mDatas.isEmpty()) { mMaterialDialog.dismiss(); mFindNotesAdapter.notifyDataSetChanged(); } } else { mMaterialDialog.dismiss(); Toast.makeText(FindNotesAty.this, "暂无数据", Toast.LENGTH_SHORT).show(); } } }); }
Example 14
Source File: UserManager.java From TestChat with Apache License 2.0 | 5 votes |
/** * 根据用户名查询用户 * * @param name 根据用户名在服务器上查询用户 * @param listener 回调 */ public void queryUsers(String name, FindListener<User> listener) { BmobQuery<User> query = new BmobQuery<>(); query.addWhereEqualTo("username", name); query.order("createdAt"); query.findObjects(CustomApplication.getInstance(), listener); }
Example 15
Source File: MainActivity.java From bmob-android-demo-paging with GNU General Public License v3.0 | 4 votes |
/** * 分页获取数据 * * @param page * 页码 * @param actionType * ListView的操作类型(下拉刷新、上拉加载更多) */ private void queryData(int page, final int actionType) { Log.i("bmob", "pageN:" + page + " limit:" + limit + " actionType:" + actionType); BmobQuery<TestData> query = new BmobQuery<>(); // 按时间降序查询 query.order("-createdAt"); int count = 0; // 如果是加载更多 if (actionType == STATE_MORE) { // 处理时间查询 Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { date = sdf.parse(lastTime); Log.i("0414", date.toString()); } catch (ParseException e) { e.printStackTrace(); } // 只查询小于等于最后一个item发表时间的数据 query.addWhereLessThanOrEqualTo("createdAt", new BmobDate(date)); // 跳过之前页数并去掉重复数据 query.setSkip(page * count + 1); } else { // 下拉刷新 page = 0; query.setSkip(page); } // 设置每页数据个数 query.setLimit(limit); // 查找数据 query.findObjects(MainActivity.this, new FindListener<TestData>() { @Override public void onSuccess(List<TestData> list) { if (list.size() > 0) { if (actionType == STATE_REFRESH) { // 当是下拉刷新操作时,将当前页的编号重置为0,并把bankCards清空,重新添加 curPage = 0; bankCards.clear(); // 获取最后时间 lastTime = list.get(list.size() - 1).getCreatedAt(); } // 将本次查询的数据添加到bankCards中 for (TestData td : list) { bankCards.add(td); } // 这里在每次加载完数据后,将当前页码+1,这样在上拉刷新的onPullUpToRefresh方法中就不需要操作curPage了 curPage++; // showToast("第"+(page+1)+"页数据加载完成"); } else if (actionType == STATE_MORE) { showToast("没有更多数据了"); } else if (actionType == STATE_REFRESH) { showToast("没有数据"); } mPullToRefreshView.onRefreshComplete(); } @Override public void onError(int arg0, String arg1) { showToast("查询失败:" + arg1); mPullToRefreshView.onRefreshComplete(); } }); }
Example 16
Source File: SecondFragment.java From myapplication with Apache License 2.0 | 4 votes |
/** * 获取数据:获取云端最近时间内的5条数据 */ private void generateData() { Log.i("LOG", "mDate in generateData >>> " + mDate); BmobQuery<ComUserPostInfo> postInfoBmobQuery = new BmobQuery<ComUserPostInfo>(); postInfoBmobQuery.addWhereLessThanOrEqualTo("createdAt", new BmobDate(mDate)); postInfoBmobQuery.order("-createdAt"); // 按时间降序排列 postInfoBmobQuery.setLimit(QUERY_ITEM_LIMITS); // 设定返回的查询条数 // 设定查询缓存策略-CACHE_ELSE_NETWORK: 先从缓存读取数据, 如果没有, 再从网络获取. postInfoBmobQuery.setCachePolicy(BmobQuery.CachePolicy.CACHE_ELSE_NETWORK); postInfoBmobQuery.setMaxCacheAge(TimeUnit.DAYS.toMillis(7)); //此表示缓存一天 postInfoBmobQuery.findObjects(new FindListener<ComUserPostInfo>() { @Override public void done(List<ComUserPostInfo> list, BmobException e) { if (e == null) { mNoDataTv.setVisibility(View.GONE); for (ComUserPostInfo comUserPostInfo : list) { mList.add(comUserPostInfo); } // get the last item post time if (!mList.isEmpty()) { mComAppAdapter = new ComAppAdapter(getActivity()); mComAppAdapter.setData(mList); mListView.setAdapter(mComAppAdapter); ComUserPostInfo lastPostInfo = mList.get(mList.size() - 1); Log.i("LOG", "lastPostInfo.getUserTimeStr() in generateData " + lastPostInfo.getUserTimeStr()); lastItemPostTimeStr = lastPostInfo.getUserTimeStr(); } else { mNoDataTv.setText("暂无数据!"); mNoDataTv.setVisibility(View.VISIBLE); } mProgressBar.setVisibility(ProgressBar.GONE); } else { mProgressBar.setVisibility(ProgressBar.GONE); mNoDataTv.setText("加载数据出错"); mNoDataTv.setVisibility(View.VISIBLE); } } }); }
Example 17
Source File: SecondFragment.java From myapplication with Apache License 2.0 | 4 votes |
/** * 上拉加载更多数据:获取云端最近时间内的5条数据 * 思路:获取应用第一次打开时加载的数据的最后一个时间, * 上滑加载更多时, 数据取该日期之前的数据, 之后更新时间 */ private void generateLoadMoreData() { // get last item post time Date newdate = DateUtil.string2Date(lastItemPostTimeStr); Log.i("LOG", "newdate in generateLoadMoreData >>> " + newdate); BmobQuery<ComUserPostInfo> postInfoBmobQuery = new BmobQuery<>(); postInfoBmobQuery.addWhereLessThanOrEqualTo("createdAt", new BmobDate(newdate)); postInfoBmobQuery.order("-createdAt"); // 按时间降序排列 postInfoBmobQuery.setLimit(QUERY_ITEM_LIMITS); // 设定返回的查询条数 // 设定查询缓存策略-CACHE_ELSE_NETWORK: 先从网络读取数据, 如果没有, 再从缓存获取. postInfoBmobQuery.setCachePolicy(BmobQuery.CachePolicy.NETWORK_ELSE_CACHE); postInfoBmobQuery.setMaxCacheAge(TimeUnit.DAYS.toMillis(7)); //此表示缓存一天 postInfoBmobQuery.findObjects(new FindListener<ComUserPostInfo>() { @Override public void done(List<ComUserPostInfo> list, BmobException e) { if (e == null) { if (list.size() == 0) { SystemUtils.showHandlerToast(getActivity(), "没有更多内容了..."); Log.i("LOG", "list.size() in generateLoadMoreData >>> " + list.size()); } else { for (ComUserPostInfo comUserPostInfo : list) { mList.add(comUserPostInfo); } // 监听数据的变化, 上拉加载更多后处于当前可视的最后一个item位置 mComAppAdapter.notifyDataSetChanged(); // get the last item post time if (!mList.isEmpty()) { ComUserPostInfo lastPostInfo = mList.get(mList.size() - 1); Log.i("LOG", "lastPostInfo.getUserTimeStr() in generateLoadMoreData" + lastPostInfo.getUserTimeStr()); lastItemPostTimeStr = lastPostInfo.getUserTimeStr(); } } mProgressBar.setVisibility(ProgressBar.GONE); } else { mProgressBar.setVisibility(ProgressBar.GONE); } } }); }
Example 18
Source File: WeiboListActivity.java From stynico with MIT License | 4 votes |
/** * 查询微博 */ private void findWeibos() { BmobQuery<Post_> query = new BmobQuery<Post_>(); query.order("-updatedAt"); query.include("author");// 希望在查询微博信息的同时也把发布人的信息查询出来,可以使用include方法 query.findObjects(this, new FindListener<Post_>() { @Override public void onSuccess(List<Post_> object) { // TODO Auto-generated method stub weibos = object; adapter.notifyDataSetChanged(); //et_content.setText(""); } @Override public void onError(int code, String msg) { // TODO Auto-generated method stub //toast("查询失败:"+msg); } }); //等价于下面的sql语句查询 // String sql = "select include author,* from Post where author = pointer('_User', "+"'"+user.getObjectId()+"')"; // new BmobQuery<Post>().doSQLQuery(this, sql, new SQLQueryListener<Post>(){ // // @Override // public void done(BmobQueryResult<Post> result, BmobException e) { // // TODO Auto-generated method stub // if(e ==null){ // List<Post> list = (List<Post>) result.getResults(); // if(list!=null && list.size()>0){ // weibos = list; // adapter.notifyDataSetChanged(); // et_content.setText(""); // }else{ // Log.i("smile", "查询成功,无数据返回"); // } // }else{ // Log.i("smile", "错误码:"+e.getErrorCode()+",错误描述:"+e.getMessage()); // } // } // }); }
Example 19
Source File: Main4Activity.java From styT with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_4main); final SharedPreferences i = getSharedPreferences("pHello500", 0); Boolean o0 = i.getBoolean("FIRST", true); if (o0) {//第一次截图 /* AppCompatDialog alertDialog = new AlertDialog.Builder(this) .setTitle("其他规则") .setMessage("邀请一个人可以得*+0.10现金{0.25现金上限25人<其他现金无上限}\n推荐 一个人截一图") .setNeutralButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { i.edit().putBoolean("FIRST", false).apply(); } }).setCancelable(false).create(); alertDialog.show();*/ } else { } toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setSubtitleTextAppearance(this, R.style.ts); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View p1) { finish(); } }); // finish(); xft(); Intent intent = new Intent(this, DownloadService.class); startService(intent); bindService(intent, mServiceConnection, BIND_AUTO_CREATE); if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); } myUser = BmobUser.getCurrentUser(MyUser.class); init(); listView = (android.support.v7.widget.ListViewCompat) findViewById(R.id.lv_feedback); emptyView = new TextView(this); emptyView.setText(""); emptyView.setGravity(Gravity.CENTER); //emptyView.setTextSize(15); //设置字体大小 LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); addContentView(emptyView, params); listView.setEmptyView(emptyView); BmobQuery<xp> query = new BmobQuery<>(); query.order("-createdAt"); query.findObjects(new FindListener<xp>() { @Override public void done(List<xp> object, BmobException e) { if (e == null) { adapter = new FeedbackAdapter(Main4Activity.this, object); listView.setAdapter(adapter); } else { emptyView.setText((CharSequence) object); } } }); }
Example 20
Source File: Blanknt.java From styT with Apache License 2.0 | 4 votes |
/** * 初始化数据 */ private void query(int page) { BmobQuery<BILIBILI> helpsBmobQuery = new BmobQuery<BILIBILI>(); helpsBmobQuery.setLimit(Constant.NUMBER_PAGER); helpsBmobQuery.order("-createdAt"); // BmobDate date=new BmobDate(new Date(System.currentTimeMillis())); // helpsBmobQuery.addWhereLessThan("createdAt",date); helpsBmobQuery.setSkip(Constant.NUMBER_PAGER * page); helpsBmobQuery.include("user,phontofile"); // helpsBmobQuery.include("phontofile"); helpsBmobQuery.findObjects(new FindListener<BILIBILI>() { @Override public void done(List<BILIBILI> object, BmobException e) { if (e == null) { //mProgressDialog.dismiss(); if (object.size() > 0) { if (refleshType == RefleshType.REFRESH) { numPage = 0; mItemList.clear(); } if (object.size() < Constant.NUMBER_PAGER) { } mItemList.addAll(object); numPage++; adapter.notifyDataSetChanged(); materialRefreshLayout.finishRefresh(); materialRefreshLayout.finishRefreshLoadMore(); } else if (refleshType == RefleshType.REFRESH) { materialRefreshLayout.finishRefresh(); } else if (refleshType == RefleshType.LOAD_MORE) { materialRefreshLayout.finishRefreshLoadMore(); } else { numPage--; } } else { //mProgressDialog.dismiss(); materialRefreshLayout.finishRefresh(); materialRefreshLayout.finishRefreshLoadMore(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog alert = builder.setMessage("未获取到数据,请检查网络数据后重试。") .setNegativeButton("确认", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .create(); alert.show(); } } }); }