We have used Glide to fetch a single image from a folder in firebase storage, and tried populating a RecyclerView. Used the firebaseImageLoader class. But are unable to fetch multiple images directly from a folder . Here is the adapter.
public class GalleryAdapter extends
RecyclerView.Adapter<GalleryAdapter.MyViewHolder> {
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef;
private Context mContext;
public class MyViewHolder extends RecyclerView.ViewHolder {
public ImageView thumbnail;
public MyViewHolder(View view) {
super(view);
thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
}
}
public GalleryAdapter(Context context, StorageReference Ref) {
mContext = context;
this.storageRef = Ref;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.gallery_thumbnail, parent, false);
return new MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
// Image image = storageRef.get(position);
Glide.with(mContext).using(new FirebaseImageLoader())
.load(storageRef)
.thumbnail(0.5f)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(holder.thumbnail);
}
@Override
public int getItemCount() {
return storage.hashCode() ;
}
And this is how in the MainActivity we are passing the bucket address of our console.
String uri="gs://gallery-sync.appspot.com/images/p2.jpg";
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl(uri);
We are beginners and, cannot seem to find a "Easy to understand" way of integrating the firebase DATABASE into our simple app. IF THERE IS A WAY BY WHICH, WE CAN OBTAIN A JASON STRUCTURE OF OUR DATA STORED IN THE firebase 'STORAGE'. We might just be able to work around it. Thank You.