/** Updates list of post views from given FBFeed. */
  private void updateFeedView(FBFeed fbFeed) {
    LinearLayout contentView = (LinearLayout) findViewById(R.id.activity_feed_content);
    contentView.setVisibility(View.GONE);
    contentView.removeAllViews();
    int j = 0;
    for (FBPost post : fbFeed.getPosts()) {
      View postView = createPostView(post);
      postView.setTag(post.getId());
      if (j == 0) {
        FirstPostId = post.getId();
        Log.e("----------FirstPostId=", FirstPostId);
      }
      ;
      Log.e("postId", post.getId());
      Log.e("FirstPostId=", FirstPostId);
      j++;
      ImageView imageView = (ImageView) postView.findViewById(R.id.view_post_picture);
      if (post.getPicture() != null) {
        imageView.setVisibility(View.GONE);
        FBBitmap fbBitmap = getGlobalState().getFBFactory().getBitmap(post.getPicture());
        Bitmap bitmap = fbBitmap.getBitmap();
        if (bitmap != null) {
          imageView.setImageBitmap(bitmap);
        } else {
          PostPictureRequest request = new PostPictureRequest(this, imageView, fbBitmap);
          getGlobalState().getRequestQueue().addRequest(request);
        }
      } else {
        imageView.setVisibility(View.GONE);
      }

      BitmapSwitcher profilePic =
          (BitmapSwitcher) postView.findViewById(R.id.view_post_from_picture);
      FBUser fbUser = getGlobalState().getFBFactory().getUser(post.getFromId());
      if (fbUser.getLevel() == FBUser.Level.UNINITIALIZED) {
        profilePic.setBitmap(mDefaultPicture);
        FromPictureRequest request = new FromPictureRequest(this, profilePic, fbUser);
        getGlobalState().getRequestQueue().addRequest(request);
      } else {
        FBBitmap fbBitmap = getGlobalState().getFBFactory().getBitmap(fbUser.getPicture());
        Bitmap bitmap = fbBitmap.getBitmap();
        if (bitmap != null) {
          profilePic.setBitmap(BitmapUtils.roundBitmap(bitmap, PICTURE_ROUND_RADIUS));
        } else {
          profilePic.setBitmap(mDefaultPicture);
          FromPictureRequest request = new FromPictureRequest(this, profilePic, fbUser);
          getGlobalState().getRequestQueue().addRequest(request);
        }
      }
      postView.setOnClickListener(mPostClickObserver);
      if (!(j == 0)) {
        contentView.addView(postView);
      }
      ;
    }
    TextView textForAdvise = (TextView) findViewById(R.id.textForAdvise);
    textForAdvise.setVisibility(View.GONE);
    contentView.setVisibility(View.VISIBLE);
  }
  private void updateComments() {
    LinearLayout container = (LinearLayout) findViewById(R.id.activity_post_content);
    container.removeAllViews();

    for (FBComment comment : mFBPost.getComments()) {
      View commentView = getLayoutInflater().inflate(R.layout.view_comment, null);

      TextView fromView = (TextView) commentView.findViewById(R.id.view_comment_from);
      fromView.setText(comment.getFromName());

      TextView messageView = (TextView) commentView.findViewById(R.id.view_comment_message);
      messageView.setText(comment.getMessage());

      TextView detailsView = (TextView) commentView.findViewById(R.id.view_comment_details);
      detailsView.setText(StringUtils.convertFBTime(comment.getCreatedTime()));

      container.addView(commentView);
    }
  }
  /** Creates new feed post View. */
  private View createPostView(FBPost post) {
    // Create default Feed Item view.
    View postView = getLayoutInflater().inflate(R.layout.view_post, null);

    // Set sender's name.
    String fromId = post.getFromId();
    String fromName = post.getFromName();
    TextView fromView = (TextView) postView.findViewById(R.id.view_post_from);
    StringUtils.setTextLink(fromView, fromName, PROTOCOL_SHOW_PROFILE + fromId, mSpanClickObserver);

    // Get message from feed item. Message is the one user can add as a
    // description to items posted.
    String message = post.getMessage();
    TextView messageView = (TextView) postView.findViewById(R.id.view_post_message);
    if (message != null) {
      StringUtils.setTextLinks(messageView, message, null);
    } else {
      messageView.setVisibility(View.GONE);
    }

    // Get name from feed item. Name is shortish description like string
    // for feed item.
    String name = post.getName();
    TextView nameView = (TextView) postView.findViewById(R.id.view_post_name);
    if (name != null) {
      if (post.getLink() != null) {
        StringUtils.setTextLink(nameView, name, post.getLink(), null);
      } else {
        nameView.setText(name);
      }
    } else {
      nameView.setVisibility(View.GONE);
    }

    String caption = post.getCaption();
    TextView captionView = (TextView) postView.findViewById(R.id.view_post_caption);
    if (caption != null) {
      StringUtils.setTextLinks(captionView, caption, null);
    } else {
      captionView.setVisibility(View.GONE);
    }

    // Get description from feed item. This is longer description for
    // feed item.
    String description = post.getDescription();
    TextView descriptionView = (TextView) postView.findViewById(R.id.view_post_description);
    if (description != null) {
      StringUtils.setTextLinks(descriptionView, description, null);
    } else {
      descriptionView.setVisibility(View.GONE);
    }

    // Convert created time to more readable format.
    String createdTime = post.getCreatedTime();
    createdTime = StringUtils.convertFBTime(createdTime);
    TextView detailsView = (TextView) postView.findViewById(R.id.view_post_details);
    detailsView.setText(
        getResources()
            .getString(
                R.string.activity_feed_post_details,
                createdTime,
                post.getCommentsCount(),
                post.getLikesCount()));

    return postView;
  }