Closed
Description
ParseLiveQueryClient parseLiveQueryClient = ParseLiveQueryClient.Factory.getClient();
//mPosts.clear();
ParseQuery<Post> query = ParseQuery.getQuery(Post.class);
// Connect to Parse server
SubscriptionHandling<Post> subscriptionHandling = parseLiveQueryClient.subscribe(query);
// Listen for CREATE events
subscriptionHandling.handleEvent(SubscriptionHandling.Event.CREATE, new SubscriptionHandling.HandleEventCallback<Post>() {
@Override
public void onEvent(ParseQuery<Post> query, Post object) {
mPosts.add(0, object);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
adapter.notifyDataSetChanged();
recyclerView.scrollToPosition(0);
}
});
}
});
Is there a problem with my code? But why can't it be implemented?
Metadata
Metadata
Assignees
Labels
No labels