指针,关系和文件如何同步解析?

时间:2015-09-18 13:35:56

标签: android parse-platform

我在我的android项目中使用parse作为BaaS。如果我创建自定义解析对象并根据需要保存它,则面对重复数据。

此外,我尝试将解析对象扩展到所需的类,这会导致其他问题!

 public void retrieveThreadListStoreInDB()
    {
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Threads");
        query.include("postedBy");
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> list, ParseException e) {
                if (e == null) {
                    // Data retrieval was successfull
                    for (ParseObject parseObject : list) {
                        String title = (String) parseObject.get("threadTitle");
                        ParseUser parseUser = (ParseUser) parseObject.get("postedBy");
                        ParseFile userProfilePicture=null;
                        try
                        {
                            userProfilePicture = (ParseFile) parseUser.get("profilePicture");
                        }
                        catch (Exception e1)
                        {

                        }
                        String profilePictureUrl=null;
                        if(userProfilePicture != null) {
                             profilePictureUrl = (userProfilePicture).getUrl();
                        }
                        ParseObject threadsList = new ParseObject("ThreadsList");
                        threadsList.put("threadTitle",title);
                        if(profilePictureUrl != null) {
                            threadsList.put("postedByPicture", profilePictureUrl);
                        }
                        else {
                            threadsList.put("postedByPicture","local");
                        }

                        try {
                            threadsList.pin();
                        } catch (ParseException e1) {
                            e1.printStackTrace();
                        }
                        Log.d("DEBUG", title);
//                        Log.d("DEBUG",profilePictureUrl);
                    }
                } else {
                    Log.d("DEBUG", "Problem with retrieval" + e);
                }

            }
        });

    }
  

帮助我解决重复数据的问题以及存储文件的最佳方式网址,指针相关的信息和关系信息?????

0 个答案:

没有答案