I'm trying to use blog id to get JSON object from server. At the moment I'm getting this error
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()
on a null object reference`.How do I use the post Id to get the full content what am I doing wrong. Please help!!!
MyBlog Adapter:
public class MyBlogAdapter extends RecyclerView.Adapter<BlogViewHolder> {
    List<BlogResponse> postsList;
    Context context;
    public static String blog_Id, blogID;
    private LayoutInflater inflater;
    public MyBlogAdapter(Context context, List<BlogResponse> postsList){
        this.context = context;
        this.inflater = LayoutInflater.from(context);
        this.postsList = postsList;
    }
    @Override
    public BlogViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.custom_view,parent, false);
        return new BlogViewHolder(view);
    }
    @Override
    public void onBindViewHolder(BlogViewHolder holder, int position) {
        final BlogResponse posts= postsList.get(position);
        holder.summary.setText(posts.getBlogExcerpt().trim().toString());
        holder.title.setText(posts.getBlogTitle().trim().toString());
        //  Glide.with(context).load(posts.getBlogThumbnail()).into(holder.cover);
        holder.blogHolder.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, AnotherSingleView.class);
                blog_Id = posts.getBlogId();
                intent.putExtra(blogID,blog_Id);
                Log.d("MyblogAdapter","Please check blog Id: "+blog_Id);
                context.startActivity(intent);
            }
        });
    }
    @Override
    public int getItemCount() {
        Log.d("MyBlogAdapter,","getItemCount"+postsList.size());
        return postsList == null ? (0) : postsList.size();
    }
}
SecondActivity:
public class AnotherSingleView extends AppCompatActivity {
    String postID;
    int position;
    public TextView blogTitle,blogSub,blogContent;
    public ImageView blogPic;
    List<SingleBlogPost> singleBlogPosts;
    SingleBlogPost singleBlogPost;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_another_single_view);
        Intent intent  = getIntent();
        Bundle showBlogId = intent.getExtras();
        postID = showBlogId.getString(blogID);
        Log.d("AnotherSingleView","Please check blog Id: "+postID);
        singleBlogPosts = new ArrayList<>();
        blogContent = (TextView)findViewById(R.id.blog_content);
        blogSub = (TextView) findViewById(R.id.blog_subtitle);
        blogTitle =(TextView) findViewById(R.id.blog_title);
        blogPic =(ImageView) findViewById(R.id.blog_pix);
        singlePostDisplay();
    }
private void singlePostDisplay() {
    BlogaPI api = ApiClient.getBlogInterface();
    Call<List<SingleBlogPost>> call = api.postResponse(postID);
    call.enqueue(new Callback<List<SingleBlogPost>>() {
        @Override
        public void onResponse(Call<List<SingleBlogPost>> call, Response<List<SingleBlogPost>> response) {
            singleBlogPosts = response.body();
            if (singleBlogPosts != null && !singleBlogPosts.isEmpty() ){
                for (SingleBlogPost posts : singleBlogPosts){
                    Log.d("AnotherSingleView","Please check RESPONSE: "+response.body().toString());
                    blogTitle.setText(posts.getBlogTitle());
                    blogSub.setText(posts.getBlogSubtitle());
                    blogContent.setText(posts.getBlogContent());
                    // Glide.with(AnotherSingleView.this).load(singlepost.getBlogMedimg()).into(blogPic);
                }
            }
            else{
                Toast.makeText(AnotherSingleView.this, "Something is empty", Toast.LENGTH_SHORT).show();
            }            }
            @Override
            public void onFailure(Call<List<SingleBlogPost>> call, Throwable t) {
                Toast.makeText(AnotherSingleView.this, "check again: "+t.toString(), Toast.LENGTH_SHORT).show();
            }
        });
    }
}
Interface:
public interface BlogaPI {
    @GET("blog")
    Call<BlogList> response();
    @GET("post/{blog_id}")
    Call<List<SingleBlogPost>> postResponse(@Path("blog_id") String blog_id);
    //Call<List<SingleBlogPost>> postResponse();
}
SingleBlogPost:
public class SingleBlogPost {
@SerializedName("blog_id")
@Expose
private String blogId;
@SerializedName("blog_title")
@Expose
private String blogTitle;
@SerializedName("blog_subtitle")
@Expose
private String blogSubtitle;
@SerializedName("blog_excerpt")
@Expose
private String blogExcerpt;
@SerializedName("blog_content")
@Expose
private String blogContent;
@SerializedName("blog_thumbnail")
@Expose
private String blogThumbnail;
@SerializedName("blog_medimg")
@Expose
private String blogMedimg;
@SerializedName("category_title")
@Expose
private String categoryTitle;
public SingleBlogPost(String blogId,String blogTitle, String blogSubtitle, String blogExcerpt,
                      String blogContent, String blogThumbnail, String blogMedimg, String categoryTitle){
    this.blogId = blogId;
    this.blogTitle = blogTitle;
    this.blogSubtitle = blogSubtitle;
    this.blogExcerpt = blogExcerpt;
    this.blogContent = blogContent;
    this.blogThumbnail = blogThumbnail;
    this.blogMedimg = blogMedimg;
    this.categoryTitle = categoryTitle;
}
public String getBlogId() {
    return blogId;
}
public void setBlogId(String blogId) {
    this.blogId = blogId;
}
public String getBlogTitle() {
    return blogTitle;
}
public void setBlogTitle(String blogTitle) {
    this.blogTitle = blogTitle;
}
public String getBlogSubtitle() {
    return blogSubtitle;
}
public void setBlogSubtitle(String blogSubtitle) {
    this.blogSubtitle = blogSubtitle;
}
public String getBlogExcerpt() {
    return blogExcerpt;
}
public void setBlogExcerpt(String blogExcerpt) {
    this.blogExcerpt = blogExcerpt;
}
public String getBlogContent() {
    return blogContent;
}
public void setBlogContent(String blogContent) {
    this.blogContent = blogContent;
}
public String getBlogThumbnail() {
    return blogThumbnail;
}
public void setBlogThumbnail(String blogThumbnail) {
    this.blogThumbnail = blogThumbnail;
}
public String getBlogMedimg() {
    return blogMedimg;
}
public void setBlogMedimg(String blogMedimg) {
    this.blogMedimg = blogMedimg;
}
public String getCategoryTitle() {
    return categoryTitle;
}
public void setCategoryTitle(String categoryTitle) {
    this.categoryTitle = categoryTitle;
}
}
 
     
     
     
    