private void changeFollowStatus( final TextView txtFollow, final int position, final boolean isAskingToFollow) { if (!isPositionValid(position)) { return; } final long blogId; final String blogUrl; switch (getBlogType()) { case RECOMMENDED: ReaderRecommendedBlog blog = mRecommendedBlogs.get(position); blogId = blog.blogId; blogUrl = blog.getBlogUrl(); break; case FOLLOWED: ReaderBlog info = mFollowedBlogs.get(position); blogId = info.blogId; blogUrl = info.getUrl(); break; default: return; } ReaderActions.ActionListener actionListener = new ReaderActions.ActionListener() { @Override public void onActionResult(boolean succeeded) { if (!succeeded && getContext() != null) { int resId = (isAskingToFollow ? R.string.reader_toast_err_follow_blog : R.string.reader_toast_err_unfollow_blog); ToastUtils.showToast(getContext(), resId); ReaderUtils.showFollowStatus(txtFollow, !isAskingToFollow); checkFollowStatus(); } } }; if (ReaderBlogActions.performFollowAction(blogId, blogUrl, isAskingToFollow, actionListener)) { if (getBlogType() == ReaderBlogType.FOLLOWED) { mFollowedBlogs.get(position).isFollowing = isAskingToFollow; } ReaderUtils.showFollowStatus(txtFollow, isAskingToFollow); notifyDataSetChanged(); // <-- required for getView() to know correct follow status if (mFollowListener != null) { mFollowListener.onFollowBlogChanged(); } } }