当前位置: 首页>>代码示例>>Java>>正文


Java AVQuery.setLimit方法代码示例

本文整理汇总了Java中com.avos.avoscloud.AVQuery.setLimit方法的典型用法代码示例。如果您正苦于以下问题:Java AVQuery.setLimit方法的具体用法?Java AVQuery.setLimit怎么用?Java AVQuery.setLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.avos.avoscloud.AVQuery的用法示例。


在下文中一共展示了AVQuery.setLimit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNewWords

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
 * 获取最新词条
 */
private void getNewWords(){
    newWords = new ArrayList<>();
    AVQuery<AVObject> query=new AVQuery<>("word");
    query.setLimit(21);
    query.orderByDescending("updatedAt");
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if (e == null) {
                HashSet<String> set=new HashSet<>();//去重
                for (AVObject item : list) {
                    if(!set.contains(item.getString("name"))){
                        newWords.add(item);
                        set.add(item.getString("name"));
                    }
                }
                newWordAdapter.notifyDataSetChanged();
                refreshLayout.setRefreshing(false);
            } else {
                Log.e("get new words error",e.toString());
            }
        }
    });
}
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:28,代码来源:WordFragment.java

示例2: getData

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
     * 获取音/视频资源
     */
    private void getData(){
        AVQuery<AVObject> query=new AVQuery<>("jxh");
//        query.whereEqualTo("isVoice",false);
        query.setLimit(1000);
        query.orderByDescending("viewcount");
        query.include("cover");
        query.whereExists("cover");
        query.findInBackground(new FindCallback<AVObject>() {
            @Override
            public void done(List<AVObject> list, AVException e) {
                if(e==null){
                    mList= (LinkedList<AVObject>) list;
                    if(adapter!=null)
                        adapter.notifyDataSetChanged();
                }else {
                    Log.e("getVoice",e.toString());
                }
            }
        });
    }
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:24,代码来源:JxhFragment.java

示例3: onCreate

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jxh);


        AVQuery<AVObject> query=new AVQuery<>("jxh");
        query.setLimit(1000);
//        query.whereDoesNotExist("coverPic");
        query.findInBackground(new FindCallback<AVObject>() {
            @Override
            public void done(List<AVObject> list, AVException e) {
                if(e==null){
                    for(AVObject item:list){
                        attachCover(item);
//                        attachVoice(item);
//                        item.put("isVoice", isVoice(item));
                        item.saveInBackground();
                    }
                    Log.e("list size",list.size()+"");
                }
            }
        });
    }
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:25,代码来源:JXH.java

示例4: uploadStoryFile

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
 * 为story添加file
 */
private void uploadStoryFile(){
    AVQuery<AVObject> query=new AVQuery<>("story");
    query.whereExists("url");
    query.whereDoesNotExist("voiceFile");
    query.setLimit(1000);
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if (e == null) {
                for (AVObject item : list) {
                    String url = item.getString("url");
                    try {
                        AVFile avFile = AVFile.withAbsoluteLocalPath(item.getString("content") + ".mp3", "sdcard/storyFile/" + url + ".mp3");
                        item.put("voiceFile", avFile);
                        item.saveInBackground();
                    } catch (IOException e1) {
                        Log.e("upload file error", e1.toString());
                    }
                }
            }
        }
    });
}
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:27,代码来源:MyActivity.java

示例5: addTimeLong

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
 * 为story添加timelong
 */
private void addTimeLong(){
    AVQuery<AVObject> query=new AVQuery<>("story");
    query.setLimit(1000);
    query.whereExists("voiceFile");
    query.whereExists("url");
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if (e == null) {
                for (AVObject item : list) {
                    int timeLong = getTimeLong(item.getString("url"));
                    item.put("timelong", timeLong);
                    item.saveInBackground();
                }
            }
        }
    });
}
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:22,代码来源:MyActivity.java

示例6: refreshData

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void refreshData() {
    AVUser user = AVUser.getCurrentUser();
    AVQuery<AVObject> query = new AVQuery<>("user_join");
    query.setLimit(1);
    query.whereEqualTo("user", user);
    query.include("idea");
    query.include("idea.user");
    query.orderByDescending("createAt");
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            mSwipeRefreshLayout.setRefreshing(false);
            if (e == null) {
                if (!list.isEmpty()) {
                    mData.clear();
                    mData.addAll(list);
                    mAdapter.notifyDataSetChanged();
                    mOffset = list.get(list.size() - 1).getInt("ideaId");
                }
            } else {
                e.printStackTrace();
            }
        }
    });
}
 
开发者ID:AndroidCreativeDesign,项目名称:AndroidSharingPlatform,代码行数:26,代码来源:UserJoinListFragment.java

示例7: loadMoreData

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void loadMoreData() {
    AVUser user = AVUser.getCurrentUser();
    AVQuery<AVObject> query = new AVQuery<>("user_join");
    query.setLimit(1);
    query.whereEqualTo("user", user);
    query.include("idea");
    query.include("idea.user");
    query.orderByDescending("createAt");
    query.whereLessThan("ideaId", mOffset);
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            mSwipeRefreshLayout.setRefreshing(false);
            if (e == null) {
                if (!list.isEmpty()) {
                    mData.addAll(list);
                    mAdapter.notifyDataSetChanged();
                    mOffset = list.get(list.size() - 1).getInt("ideaId");
                }
            } else {
                e.printStackTrace();
            }
        }
    });
}
 
开发者ID:AndroidCreativeDesign,项目名称:AndroidSharingPlatform,代码行数:26,代码来源:UserJoinListFragment.java

示例8: refreshData

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void refreshData() {
    AVQuery<AVObject> query = new AVQuery<>("idea");
    query.whereEqualTo("user", AVUser.getCurrentUser());
    query.orderByDescending("createdAt");
    query.setLimit(1);
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            mSwipeRefreshLayout.setRefreshing(false);

            if (e == null) {
                Log.i("list.size()", list.size() + "");
                if (!list.isEmpty()) {
                    mData.clear();
                    mData.addAll(list);
                    mAdapter.notifyDataSetChanged();
                    mOffset = mData.get(mData.size() - 1).getInt("ideaId");
                }
            } else {
                e.printStackTrace();
            }
        }
    });
}
 
开发者ID:AndroidCreativeDesign,项目名称:AndroidSharingPlatform,代码行数:25,代码来源:UserPublishListFragment.java

示例9: loadMoreData

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void loadMoreData() {
    AVQuery<AVObject> query = new AVQuery<>("idea");
    query.setLimit(1);
    query.whereEqualTo("user", AVUser.getCurrentUser());
    query.orderByDescending("createdAt");
    query.whereLessThan("ideaId", mOffset);
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            mSwipeRefreshLayout.setRefreshing(false);
            if (e == null) {

                if (!list.isEmpty()) {
                    mData.addAll(list);
                    mAdapter.notifyDataSetChanged();
                    mOffset = list.get(list.size() - 1).getInt("ideaId");
                }
            }else {
                e.printStackTrace();
            }
        }
    });

}
 
开发者ID:AndroidCreativeDesign,项目名称:AndroidSharingPlatform,代码行数:25,代码来源:UserPublishListFragment.java

示例10: isDownloadImage

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
 * 从服务器查看是否需要下载图片
 *
 * @param callBack
 */
public void isDownloadImage(final IsDownloadCallBack callBack) {

    AVQuery<AVObject> query = new AVQuery<AVObject>(CLASS_NAME);
    query.orderByDescending(ID);
    query.setLimit(1);
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if (null == e) {
                if (list.size() == 1) {
                    if (sp.getInt("image", -1) < list.get(0).getInt(ID)) {

                        callBack.done(true, list.get(0));
                    } else {
                        callBack.done(false, null);
                    }

                } else
                    callBack.done(false, null);
            } else
                callBack.done(false, null);
        }
    });
}
 
开发者ID:xia-weiyang,项目名称:MainScreenShow,代码行数:30,代码来源:LaunchImage.java

示例11: onComplete

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
@Override
public void onComplete(final Platform platform, int action,
		HashMap<String, Object> res) {

	AVQuery<AVObject> query = new AVQuery<AVObject>("Users");
	query.whereEqualTo("platform", platform.getName());
	query.whereEqualTo("uid", platform.getDb().getUserId());
	query.setLimit(1);
	query.findInBackground(new FindCallback<AVObject>() {
		@Override
		public void done(List<AVObject> objects, AVException e) {
			if (e == null) {
				if (objects.size() > 0) {
					saveInformation(platform, true, objects.get(0));
				} else {
					saveInformation(platform, false, null);
				}
			} else {
				mHandler.sendEmptyMessage(AUTH_SAVE_FAILED);
			}
		}
	});

}
 
开发者ID:daimajia,项目名称:AnimeTaste,代码行数:25,代码来源:SocialPlatform.java

示例12: fetchUsers

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public void fetchUsers(final List<String> ids, final CacheUserCallback cacheUserCallback) {

        Set<String> uncachedIds = new HashSet<String>();
        for (String id : ids) {
            if (!mAvUsersCache.containsKey(id)) {
                uncachedIds.add(id);
            }
        }
        if (uncachedIds.isEmpty()) {
            if (null != cacheUserCallback) {
                cacheUserCallback.done(getUsersFromCache(ids), null);
                return;
            }
        }
        AVQuery<AVUser> q = AVUser.getQuery();
        q.whereContainedIn(OBJECT_ID, uncachedIds);
        q.setLimit(1000);
        q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
        q.findInBackground(new FindCallback<AVUser>() {
            @Override
            public void done(List<AVUser> list, AVException e) {
                if (null == e) {
                    for (AVUser user : list) {
                        mAvUsersCache.put(user.getObjectId(), user);
                    }
                }
                if (null != cacheUserCallback) {
                    cacheUserCallback.done(getUsersFromCache(ids), e);
                }
            }
        });
    }
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:33,代码来源:UserCacheHelper.java

示例13: getMoreNote

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public static List<AVObject> getMoreNote(String user, int skip, int limit, boolean isFirst)
        throws AVException {
    AVQuery<AVObject> query = new AVQuery<>("Note");
    query.whereEqualTo("user_tel", user);
    query.orderByDescending("note_editedAt");
    query.setLimit(limit);
    query.setSkip(isFirst ? skip : 0);
    return query.find();
}
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:10,代码来源:NoteService.java

示例14: getStory

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
 * 获取故事列表
 */
public void getStory(){
    AVQuery<AVObject> query=new AVQuery<>("story");

    query.setSkip(skip);
    skip=skip+30;

    query.setLimit(30);
    query.orderByDescending("createdAt");
    query.include("provider");//包括provider 避免重复查询
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if (e == null) {
                for (AVObject item : list) {
                    storyList.add(item);
                }
                adapter.notifyDataSetChanged();
                refreshLayout.setRefreshing(false);
            } else {
                Log.e("get story list error", e.toString());
            }
        }
    });


}
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:30,代码来源:StoryFragment.java

示例15: getRelativeWords

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
 * search()时获取当前词条的相关词条显示在底部
 */
private void getRelativeWords(){
    wordsRelative = new ArrayList<>();
    AVQuery<AVObject> query=new AVQuery<>("word");
    String s=tv_search.getText().toString();
    int len=s.length();
    int index= (int) (Math.random()*len);
    query.whereContains("name", String.valueOf(s.charAt(index)));
    query.setLimit(20);
    if(currentLang!=0){//如果语言为全部,则不做限制
        query.whereEqualTo("lang",currentLang+"");
    }
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if(e==null){
                if(list.size()>0){
                    for(AVObject item:list){
                        if(!wordsRelative.contains(item.getString("name"))){
                            wordsRelative.add(item.getString("name"));
                        }
                    }
                    rl_word_relative.setVisibility(View.VISIBLE);
                    myAdapter.notifyDataSetChanged();
                }else {
                    rl_word_relative.setVisibility(View.INVISIBLE);
                }
            }
        }
    });
}
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:34,代码来源:WordActivity.java


注:本文中的com.avos.avoscloud.AVQuery.setLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。