本文整理汇总了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());
}
}
});
}
示例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());
}
}
});
}
示例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()+"");
}
}
});
}
示例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());
}
}
}
}
});
}
示例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();
}
}
}
});
}
示例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();
}
}
});
}
示例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();
}
}
});
}
示例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();
}
}
});
}
示例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();
}
}
});
}
示例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);
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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();
}
示例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());
}
}
});
}
示例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);
}
}
}
});
}