Activity A has a recycler view, which has each row as a post, now each post has a comment count textview which launches a comment activity where user can see comments and also add comments.
Now question is, after adding a comment how do I update the comment count in that particular row of recycler view in Activity A when comment Activity finishes or pressing back button to get back on posts page. But I don't want to reload the recycler view again as it will distract the user from the current location.
Please guide me in the right direction. Below is my Recyclerview adapter code snippet.
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
int viewType = getItemViewType(position);
final Posts posts = postsList.get(position);
final viewHolderPost viewHolderPost = (viewHolderPost) viewHolder;
viewHolderPost.commentcount_wrap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), CommentViewerActivity.class);
intent.putExtra("post_id", posts.getPost_id());
v.getContext().startActivity(intent);
}
});
}