从Firebase检索存储的图像并添加到自定义Listview

时间:2016-12-09 17:54:00

标签: image listview firebase firebase-realtime-database firebase-storage

我试图从FireBase中的Storage中检索图像,并将它们添加到ListView中,但它给出了错误,请帮忙,我做错了什么。 感谢。

var1: 18
var2: []
var3: True

2 个答案:

答案 0 :(得分:0)

如果它有帮助,(我不知道Glide),在毕加索,通常是这样做的

Picasso.with(context).load(imageLink).into(profilePic);

答案 1 :(得分:0)

问题出在ImageView imageView =(ImageView)view.findViewById(R.id.imageDealer); //我在findViewById之前添加了视图

 DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child("Test");

mAdapter = new FirebaseListAdapter<HelperFile>(this, HelperFile.class, R.layout.custom_cell, ref) {
    @Override
    protected void populateView(View view, HelperFile value, int position) {

        ((TextView) view.findViewById(R.id.textViewName)).setText(value.getXXX());
        ((TextView) view.findViewById(R.id.textViewEmail)).setText(value.getYYY());
        ((TextView) view.findViewById(R.id.textViewSap)).setText(value.getZZZ());
        //((TextView) view.findViewById(R.id.textViewDate)).setText(value.getDate());

        StorageReference storageRef = storage.getReferenceFromUrl("my Url");
        StorageReference pathReference = storageRef.child("Images/ooo.jpg");
        ImageView imageView = (ImageView) view.findViewById(R.id.imageDealer);
        Glide.with(ListView.this)
        .using(new FirebaseImageLoader())
        .load(pathReference)
        .into(imageView);
    }

};
mListView.setAdapter(mAdapter);

}