我已经尽力了,但是我仍然无法弄清楚为什么这段代码没有显示Firebase存储器中的图像。我从数据库中正确获取了值。
FirebaseRecyclerAdapter<prod_list,productdetails>
firebaseRecyclerAdapter=new FirebaseRecyclerAdapter
<prod_list,productdetails>(prod_list.class,R.layout.prodlist,productdetails.class,mdatabase){
@Override
protected void populateViewHolder(productdetails viewHolder, prod_list model, int position) {
final String id=getRef(position).getKey();
viewHolder.setprod_name(model.getProduct_name());
viewHolder.setprod_price(model.getProduct_price());
viewHolder.setprod_quan(model.getAvailable_stock());
viewHolder.setimage(getActivity(),model.getProduct_image());
viewHolder.prodview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent cardviewintent=new Intent(getActivity(),Editproduct.class);
cardviewintent.putExtra("prod_id",id);
startActivity(cardviewintent);
}
});
}
};
prodlist.setAdapter(firebaseRecyclerAdapter);
还有setimage函数。
public void setimage(Context ctx,String image)
{
ImageView prod_image=(ImageView)prodview.findViewById(R.id.prod_image);
Picasso.get().load(image).into(prod_image);
}