title: Loading images in recycler view with Glide
body: <p>I am attempting to load images from firebase into a recycler adapter and display them </p>
  
  <p>I have attempted two methods to try and solve this problem the first block of code resulted in the error"You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed)" </p>
  
  <p>The second method the application ran but no images were loaded from reading other similar issues I have seen the isAdded() check but I couldn't seem to get that to work the images are being uploaded into a folder in firebase called post_images and the rest of the data associated with the post (Instagram like app with posting) are in firestore </p>
  
  <pre><code>public BlogRecyclerAdapter(List&lt;BlogPost&gt; blog_list) {
  
      this.blog_list = blog_list;
  
  }
  
  @NonNull
  @Override
  public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
  
      View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.blog_list_item, parent, false);
      return new ViewHolder(view);
  }
  
  
  @Override
  public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
  
      String desc_data = blog_list.get(position).getDesc();
      holder.setDescText(desc_data);
  
      String image_url = blog_list.get(position).getImage_url();
      holder.setBlogImage(image_url);
  
  }
  
  @Override
  public int getItemCount() {
      return blog_list.size();
  }
  
  public class ViewHolder extends RecyclerView.ViewHolder {
  
      private View mView;
  
      private TextView descView;
      private ImageView blogImageView;
      public Context mContext;
  
      public ViewHolder(View itemView) {
          super(itemView);
          mView = itemView;
  
      }
  
      public void setDescText(String descText) {
  
          descView = mView.findViewById(R.id.blog_desc);
          descView.setText(descText);
  
      }
  
      public void setBlogImage(final String downloadUri) {
  
          blogImageView = mView.findViewById(R.id.Post_image_view);
          Glide.with(mContext).load(downloadUri).into(blogImageView);
  
  
      }}}
  </code></pre>
  
  <p>Other method attempted</p>
  
  <pre><code>        mCurrentUser = FirebaseAuth.getInstance().getCurrentUser();
          mImageStorage = FirebaseStorage.getInstance().getReference();
  
          final String current_uid = mCurrentUser.getUid();
  
          mUserDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child(current_uid);
          mUserDatabase.keepSynced(true);
  
          mUserDatabase.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
  
                  StorageReference filepath = mImageStorage.child("profile_images").child(current_uid + (".jpeg"));
                  Log.d("heere", "S");
  
                  // This gets the download url async
                  filepath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener&lt;Uri&gt;() {
                      @Override
                      public void onSuccess(Uri uri) {
  
                          //The download url
                          final String downloadUrl = uri.toString();
                          Log.d("tag", downloadUrl);
                          if (!downloadUrl.equals("default")) {
  
                              Glide.with(mContext).load(downloadUrl).into(blogImageView);
  
                          //    Glide.with(getApplicationContext()).load(downloadUrl).into(mDisplayImage);
  
  
                          }
                      }});}
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              }
          });}}}
  </code></pre>
  
  <p>I would like the image to be displayed in the recycler view </p>