title: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
body: <p>So I have Android app with Tabs and <code>RecyclerView</code>. When I run my app, it crashes.</p>
  
  <p>logcat:</p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
          at java.io.StringReader.&lt;init&gt;(StringReader.java:47)
          at android.text.HtmlToSpannedConverter.convert(Html.java:442)
          at android.text.Html.fromHtml(Html.java:136)
          at android.text.Html.fromHtml(Html.java:99)
          at com.example.app.MyRecyclerViewAdapter2.onBindViewHolder(MyRecyclerViewAdapter2.java:80)
          at com.example.app.MyRecyclerViewAdapter2.onBindViewHolder(MyRecyclerViewAdapter2.java:17)
         ...
  </code></pre>
  
  <blockquote>
    <p>at com.example.app.MyRecyclerViewAdapter2.onBindViewHolder(MyRecyclerViewAdapter2.java:80)</p>
  </blockquote>
  
  <p>It points to this line of the code</p>
  
  <pre><code>listRowViewHolder.postId.setText(Html.fromHtml(listItems.getPostId())); // This line of code leads to crashing of app
  </code></pre>
  
  <p>If I delete this line, my app will work fine.</p>
  
  <p>MyRecyclerViewAdapter2.java:</p>
  
  <pre><code>    package com.example.app;
  
  
  import android.content.Context;
  import android.content.Intent;
  import android.support.v7.widget.RecyclerView;
  import android.text.Html;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import com.android.volley.toolbox.ImageLoader;
  
  import java.util.List;
  
  public class MyRecyclerViewAdapter2 extends RecyclerView.Adapter&lt;ListRowViewHolder&gt; {
      private List&lt;ListItems&gt; listItemsList;
      private Context mContext;
      private ImageLoader mImageLoader;
      private int focusedItem = 0;
  
  public MyRecyclerViewAdapter2(Context context, List&lt;ListItems&gt; listItemsList) {
      this.mContext = context;
      this.listItemsList = listItemsList;
  }
  
  @Override
  public ListRowViewHolder onCreateViewHolder(final ViewGroup viewGroup, int position) {
      View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_view_row2, null);
  
      ListRowViewHolder holder = new ListRowViewHolder(v);
  
      holder.itemView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              TextView postUrl =  (TextView) v.findViewById(R.id.postId);
              String post_Id = postUrl.getText().toString();
  
              Intent intent = new Intent(mContext, ViewPostActivity.class);
              intent.putExtra("id", post_Id);
              mContext.startActivity(intent);
  
          }
      });
  
      return holder;
  }
  
  @Override
  public void onBindViewHolder(ListRowViewHolder listRowViewHolder, int position) {
      ListItems listItems = listItemsList.get(position);
      listRowViewHolder.itemView.setSelected(focusedItem == position);
  
      listRowViewHolder.getLayoutPosition();
  
      mImageLoader = MySingleton.getInstance(mContext).getImageLoader();
      listRowViewHolder.thumbnail.setImageUrl(listItems.getThumbnail(), mImageLoader);
      listRowViewHolder.thumbnail.setDefaultImageResId(R.drawable.website_placeholder);
  
      listRowViewHolder.title.setText(Html.fromHtml(listItems.getTitle()));
      listRowViewHolder.date.setText(Html.fromHtml(listItems.getDate()));
      listRowViewHolder.content.setText(Html.fromHtml(listItems.getContent()));
      listRowViewHolder.postId.setText(Html.fromHtml(listItems.getPostId())); // This line of code leads to crashing of app
  }
  
  public void clearAdapter () {
      listItemsList.clear();
      notifyDataSetChanged();
  }
  
  
  @Override
  public int getItemCount() {
      return (null != listItemsList ? listItemsList.size() : 0);
  }}
  </code></pre>