0
Good morning to all. My doubt relates only to the display part of the Gridview image. See the steps that are already working:
- I can upload to Firebase Storage.
- Each time an image is sent to your server your Uri is saved in the Firebase Database.
- I have a Gridview displaying saved images in the drawable folder.
- The Firebase Storage is correctly configured because I can take an image of it and display in a Imagemview Saved in the Database.
I still can not understand how I can make the loop in Database and through Picasso display in Gridview. Thanks to those who can help.
Follow the Code of Gridview:
public class ImageAdapter extends BaseAdapter {
FirebaseStorage storage = FirebaseStorage.getInstance();
private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) {
// if it's not recycled, initialize some attributes
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(200, 200));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8, 8, 8, 8);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
return imageView;
}
// references to our images
public Integer[] mThumbIds = {
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7
};
}
Possible duplicate of How to receive all images from Firebase Storage and display in a listview
– Grupo CDS Informática
The question is not duplicated because mine refers only to the part of the display in gridview. In the other there is no such information.
– Peterson Fonseca