Swipe to delete Recyclerview brings about a null object reference error [duplicate]
Swipe to delete Recyclerview brings about a null object reference error [duplicate] This question already has an answer here: I am working with a recyclerview and am implementing swipe to delete. the code works pretty well but when I try getting my list from the adapter so that I implement swipe to delete, I get a null object reference. My adapter class is below public class TlAdapter extends RecyclerView.Adapter<TimelineVholder> { private List<FetchModel> models; private Context context; public TlAdapter(List<FetchModel> models,Context context) { this.models = models; this.context= context; } @NonNull @Override public TimelineVholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view= LayoutInflater.from(context).inflate(R.layout.timeline,parent,false); return new TimelineVholder(view,viewType); } @Override public void onBindViewHolder(@NonNull TimelineVholder holder, final int position) { SharedPreferences preferences= Prefere...
