i try to retrieve image url store in my realtime database using Glide, but it doesn't work .
this is my Onbind view :
public void onBindViewHolder(@NonNull NewRecipeAdapter.ViewRecipeHolder holder, @SuppressLint("RecyclerView") int position) {
Recipe recipe = list_of_recipe.get(position);
holder.newname.setText(recipe.getRecipe_name());
Glide.with(context).load(recipe.getImage()).centerCrop().into(holder.newImage);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String id = list_of_recipe.get(position).getRecipe_id();
Intent intent = new Intent(context,RecipePage.class);
intent.putExtra("recipe_id_home",id);
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return list_of_recipe.size();
}
public class ViewRecipeHolder extends RecyclerView.ViewHolder {
ImageView newImage;
TextView newname,calory,carb,protein,fat,time;
RelativeLayout new_layout ;
public ViewRecipeHolder(@NonNull View itemView) {
super(itemView);
new_layout = (RelativeLayout) itemView.findViewById(R.id.new_parent);
newImage = (ImageView) itemView.findViewById(R.id.new_image);
newname = (TextView) itemView.findViewById(R.id.new_name);
time=(TextView) itemView.findViewById(R.id.time);
fat= (TextView)itemView.findViewById(R.id.fat_value);
calory = (TextView) itemView.findViewById(R.id.calory_value);
carb = (TextView) itemView.findViewById(R.id.carb_value);
protein = (TextView) itemView.findViewById(R.id.pro_value);
}
this is my database :
is there a better way to save image and retrieve it?