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


Java AVQuery.findInBackground方法代码示例

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


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

示例1: findSendRequests

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public void findSendRequests(FindCallback findCallback,boolean orderAsc,Map<String,Object> conditions){
    AVUser user = HiTalkHelper.getInstance().getCurrentUser();
    AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class);
    q.whereEqualTo(AddRequest.FROM_USER, user);
    if (conditions != null) {
        for (Map.Entry<String,Object> entry : conditions.entrySet()){
            q.whereEqualTo(entry.getKey(),entry.getValue());
        }
    }
    if (orderAsc) {
        q.orderByAscending(AVObject.CREATED_AT);
    } else {
        q.orderByDescending(AVObject.CREATED_AT);
    }
    q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
    q.findInBackground(findCallback);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:18,代码来源:FriendsManager.java

示例2: runQuerySync

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public static <T extends AVObject> List<T> runQuerySync(AVQuery<T> avQuery) throws InterruptedException, AVException {
    final CountDownLatch lock = new CountDownLatch(1);
    final List<T> result = new ArrayList<>();
    final AVException[] exceptions = new AVException[1];
    avQuery.findInBackground(new FindCallback<T>() {
        @Override
        public void done(List<T> list, AVException e) {
            if (list != null) {
                result.addAll(list);
            }else {
                exceptions[0] = e;
            }
            lock.countDown();
        }
    });
    lock.await();
    if (exceptions[0] != null){
        throw exceptions[0];
    }
    return result;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:22,代码来源:AvQueryHelper.java

示例3: onCreate

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_about_app);
	//this.getActionBar().setDisplayHomeAsUpEnabled(true);
	submitButton = (Button) findViewById(R.id.button_about_app_submit_user_input);
	submitEditText = (EditText) findViewById(R.id.editText_about_app_user_input);
	mUserResponseListView = (ListView) findViewById(R.id.listView_user_back);
	submitButton.setOnClickListener(buttonListener);

   FindCallback<AVObject> findCallback=new FindCallback<AVObject>() {
     public void done(List<AVObject> avObjects, AVException e) {
       if (e == null) {
         Message msg = new Message();
         msg.what = 3;
         msg.obj = avObjects;
         mHandler.sendMessage(msg);
       } else {
         showError(activity.getString(R.string.network_error));
       }
     }
   };
	AVQuery<AVObject> query = new AVQuery<AVObject>("SuggestionByUser");
	query.whereEqualTo("UserObjectId", getUserId());
	query.findInBackground(findCallback);
}
 
开发者ID:yoxin,项目名称:pet,代码行数:27,代码来源:AboutAppActivity.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: getComments

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void getComments(){
    if(comments==null){
        comments = new ArrayList<>();
    }else {
        comments.clear();
    }
    AVQuery<AVObject> query=new AVQuery<>("storycomment");
    query.whereEqualTo("story",story);
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if(e==null){
                for(AVObject item:list){
                    comments.add(item);
                    adapter.notifyDataSetChanged();
                }
            } else {
                Log.e("get story comm err",e.toString());
            }
        }
    });
}
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:23,代码来源:StoryActivity.java

示例10: onCreate

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AVQuery<AVObject> query=new AVQuery<>("Other");
        query.whereEqualTo("name", "UpdateActivity跳转至的Url");
        query.findInBackground(new FindCallback<AVObject>() {
            @Override
            public void done(List<AVObject> list, AVException e) {
                if(e==null){
                    if (list.size()>0){
                        String url=list.get(0).getString("url");
                        Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                        startActivity(intent);
                        finish();
                    }
                }
            }
        });
//V1.0&V1.1:
//        Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.zhagame.com/fangyan"));
//        startActivity(intent);
//        finish();
    }
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:24,代码来源:UpdateActivity.java

示例11: checkFriendAdded

import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void checkFriendAdded(final String friendId) {
    AVQuery<AVObject> queryUserId1 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
    queryUserId1.whereStartsWith(Constants.KEY_USER_ID, userId);
    AVQuery<AVObject> queryUserId2 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
    queryUserId2.whereEndsWith(Constants.KEY_USER_ID, userId);
    AVQuery<AVObject> queryFriendId1 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
    queryFriendId1.whereStartsWith(Constants.KEY_FRIEND_ID, friendId);
    AVQuery<AVObject> queryFriendId2 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
    queryFriendId2.whereEndsWith(Constants.KEY_FRIEND_ID, friendId);

    AVQuery<AVObject> query = AVQuery.and(Arrays.asList(queryUserId1, queryUserId2, queryFriendId1, queryFriendId2));
    query.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(List<AVObject> list, AVException e) {
            if (list.isEmpty()) {
                Log.d(TAG, "username is not added!");
                addFriend(friendId);
            } else {
                Log.e(TAG, "username is already added!");
                ToastUtil.showToastShort(FriendActivity.this, "username is already added!");
            }
        }
    });

}
 
开发者ID:quekx,项目名称:MyShare,代码行数:26,代码来源:FriendActivity.java

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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