0
パーズクラウドに更新されたデータを自動ロードします。 ParseQueryAdapterを使用して、Parseから更新されたデータを要求しています。 commentsQueryAdapter.setAutoLoad(true)も設定しましたが、それでもデータは更新されません。ParseQueryAdapter.setAutoLoad(true)はデータをリフレッシュしません
//Set up a customized query
final ParseQueryAdapter.QueryFactory<ParseCommentsClass> factory =
new ParseQueryAdapter.QueryFactory<ParseCommentsClass>() {
public ParseQuery<ParseCommentsClass> create() {
ParseQuery<ParseCommentsClass> query = ParseCommentsClass.getQuery();
query.whereEqualTo("videoId", videoID);
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.orderByDescending("createdAt");
return query;
}
};
// Set up the query adapter
commentsQueryAdapter = new ParseQueryAdapter<ParseCommentsClass>(this, factory) {
@Override
public View getItemView(final ParseCommentsClass post, View view, ViewGroup parent) {
if (view == null) {
view = View.inflate(getContext(), R.layout.comments_layout, null);
}
ImageView ProfileView = (ImageView) view.findViewById(R.id.profilePic);
TextView usernameView = (TextView) view.findViewById(R.id.name);
TextView commentsView = (TextView)view.findViewById(R.id.comments);
String ProfileThumb = String.valueOf(post.getUserPic().getUrl());
Picasso.with(SingleVideoView.this)
.load(ProfileThumb)
.transform(new CircleTransform())
.resize(70,70)
.centerCrop()
.into(ProfileView);
usernameView.setText(post.getUser());
commentsView.setText(post.getComment());
return view;
}
};
// Disable pagination, we'll manage the query limit ourselves
// commentsQueryAdapter.setPaginationEnabled(false);
listView = (ListView)findViewById(R.id.comments_list);
listView.setAdapter(commentsQueryAdapter);
commentsQueryAdapter.setAutoload(true);
}