androidparse-platformparse-android-sdkandroid-parsequeryadapter

How should I do? ParseQueryAdapter


I want to make SNS android application. Posts that users have posted and relations("Likes") are loaded from my Parse.com server. I succeeded in loading posts using parseQueryAdapter and ListView in a Fragment. But relation ("Likes") query loading event can not be loaded.


Solution

  • ParseQueryAdapter<Post> mainAdapter;
    ParseQueryAdapter.QueryFactory<Post> factory;
    factory = new ParseQueryAdapter.QueryFactory<Post>() {
            @Override
            public ParseQuery<Post> create() {
                ParseQuery query = new ParseQuery("Post");
                query.whereEqualTo("Post_Liked", true);
                return query;
            }
        };
    mainAdapter = new ParseQueryAdapter<Post>(this, factory) {
    @Override
    public View getItemView(final Post object, View v, ViewGroup parent) {
        if (v == null) {
            v = View.inflate(getContext(), R.layout.your_list_view, null);
        }
        return v;
    }};
    

    So why don't you just make it so that the user can set a post to "liked" or "not liked" with true and false respectively?