My code adds items to favorites in SQLite:
if (productsArray.get(getAdapterPosition()).isFavorite()){
productsArray.get(getAdapterPosition()).setFavorite(false);
}else{
productsArray.get(getAdapterPosition()).setFavorite(true);
}
notifyItemChanged(getAdapterPosition());
My "notify item changed" function is not working for view. In my onBindViewHolder(), the favorite image is not changing
if (products.isFavorite()){
holder.fav_img.setImageDrawable(context.getDrawable(R.drawable.ic_favorite_on));
}else{
fav_img.setImageDrawable(context.getDrawable(R.drawable.ic_favorite_off));
}