I am using Firebase to populate my BlogRecycleadapter with blog post and get Likes from Like Buttons but when device is offline and user press Like Button , then app crashes
Try this
You can pass
Contextin your Constructor of yourBlogRecyclerAdapter
public BlogRecyclerAdapter(List < BlogPost > blog_list, Context context) {
this.blog_list = blog_list;
this.context = context;
}
use like this
firebaseFirestore = FirebaseFirestore.getInstance(context);
firebaseAuth = FirebaseAuth.getInstance(context);
Glide.with(context).applyDefaultRequestOptions(placeholderOption).load(image).into(blogUserImage);
call your
BlogRecyclerAdapterlike this
BlogRecyclerAdapter adapter= new BlogRecyclerAdapter( blog_list, YourActivity.this );