private View createTextView(Message message) {
    LayoutInflater inflater =
        (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.message_list_item_layout_2, null);

    TextView msgUsername = (TextView) view.findViewById(R.id.msgUsername);
    TextView msgTimeSent = (TextView) view.findViewById(R.id.msgTimeSent);
    TextView msgContent = (TextView) view.findViewById(R.id.msgContent);

    msgUsername.setText(message.getSender());
    msgContent.setText(message.getContent());

    Date date = new Date(Long.parseLong(message.getTimeSend()));
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm, dd.MM.yyyy.");
    msgTimeSent.setText(sdf.format(date));

    return view;
  }
  private View createImageView(Message message) {
    LayoutInflater inflater =
        (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.message_list_item_layout_1, null);

    TextView msgUsername = (TextView) view.findViewById(R.id.msgUsername);
    TextView msgTimeSent = (TextView) view.findViewById(R.id.msgTimeSent);
    ImageView msgContent = (ImageView) view.findViewById(R.id.msgContent);

    msgUsername.setText(message.getSender());

    byte[] imageBytes = Base64.decode(message.getContent(), Base64.NO_WRAP | Base64.URL_SAFE);
    Bitmap image = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
    msgContent.setImageBitmap(image);

    Date date = new Date(Long.parseLong(message.getTimeSend()));
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm, dd.MM.yyyy.");
    msgTimeSent.setText(sdf.format(date));

    return view;
  }