我想制作 SNS android 应用程序。用户发布的帖子和关系(“喜欢”)从我的 Parse.com 服务器加载。parseQueryAdapter
我成功地使用和加载ListView
了帖子Fragment
。但是无法加载关系(“喜欢”)查询加载事件。
问问题
306 次
2 回答
0
By default ParseQuery will not fetch relationship objects. You need to include relationship objects in ParseQuery.
ParseQuery<Post> postQuery= new ParseQuery<Post>("Post");
postQuery.include("likes");
于 2015-03-20T06:50:24.473 回答
0
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;
}};
那么,为什么不直接让用户将帖子设置为“喜欢”或“不喜欢”,分别为真和假呢?
于 2015-03-23T19:10:04.530 回答