Images not showing in recyclerview from firebase

I’m trying to get images from firebase into a recyclerview but it doesn’t show up I have stored the download URL in a model class so I can retrieve it later

Here is the screen with no images in recyclerview enter image description here

here is the realtimedatabe screenshot enter image description here

and also the rules are true for realtimedatabase and storage

Java Files

 public class Search_Fragment extends Fragment {
    public List<Upload> mUploads;
    PostAdapter postsAdapter;

    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_search, container, false);
        RecyclerView postRecyclerView = view.findViewById(;
        DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("uploads");
                new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
        mUploads = new ArrayList<>();
        postsAdapter = new PostAdapter(getContext(), mUploads);

        //This are images that i tried manual ly and it worked fine
//        List<PostItem> postItems = new ArrayList<>();
//        postItems.add(new PostItem(R.drawable.image1));
//        postItems.add(new PostItem(R.drawable.image2));
//        postItems.add(new PostItem(R.drawable.image3));
//        postItems.add(new PostItem(R.drawable.image4));
//        postItems.add(new PostItem(R.drawable.image5));
//        postItems.add(new PostItem(R.drawable.image7));
        databaseReference.addValueEventListener(new ValueEventListener() {
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                if (snapshot.exists()){
                    for (DataSnapshot dataSnapshot : snapshot.getChildren()) {
                        Upload upload = dataSnapshot.getValue(Upload.class);


                else {
                //notify the adapter

            public void onCancelled(@NonNull DatabaseError error) {
        return view;

PostAdapter.Java //Apadter Class

public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> {
    public static List<Upload> mUploads;
    Context mcontext;

    public PostAdapter(Context context, List<Upload> uploads) {
        mUploads = uploads;
        mcontext = context;

    public PostViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view;
        view = LayoutInflater.from(mcontext).inflate(R.layout.post_item_container, parent, false);
        return new PostViewHolder(view);

    public void onBindViewHolder(@NonNull PostViewHolder holder, int position) {
        Upload uploadCurrent = mUploads.get(position);
        Transformation transformation = new RoundedTransformationBuilder()


    public int getItemCount() {
        return mUploads.size();

    public static class PostViewHolder extends RecyclerView.ViewHolder {
        RoundedImageView postImageView;

        PostViewHolder(@NonNull View itemView) {
            postImageView = itemView.findViewById(;



public class Upload_Fragment extends Fragment {
    private static final int PICK_IMAGE_REQUEST = 10;
    private ImageView uploadImageView;
    private Uri mImageUri;
    private StorageReference storageReference;
    private DatabaseReference databaseReference;
    private StorageTask mUploadTask;

    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_upload, container, false);
        Button chooseImageButton = view.findViewById(;
        Button uploadImageButton = view.findViewById(;
        uploadImageView = view.findViewById(;
        storageReference = FirebaseStorage.getInstance().getReference("uploads");
        databaseReference = FirebaseDatabase.getInstance().getReference("uploads");
        chooseImageButton.setOnClickListener(v -> openFileChooser());
        uploadImageButton.setOnClickListener(v -> {
            if (mUploadTask != null && mUploadTask.isInProgress()) {
                Toast.makeText(getActivity(), "Upload in Progress", Toast.LENGTH_SHORT).show();

            } else {


        return view;

    private void openFileChooser() {
        Intent intent = new Intent();
        startActivityForResult(intent, PICK_IMAGE_REQUEST);

    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
                && data != null && data.getData() != null) {
            mImageUri = data.getData();


    private String getFileExtension(Uri uri) {

        ContentResolver contentResolver = Objects.requireNonNull(getActivity()).getContentResolver();
        MimeTypeMap mime = MimeTypeMap.getSingleton();
        return mime.getExtensionFromMimeType(contentResolver.getType(uri));

    private void uploadToFirebase(Uri mImageUri) {
        if (mImageUri != null) {
            final ProgressDialog progressDialog = new ProgressDialog(getActivity());

            StorageReference reference = storageReference.child(System.currentTimeMillis()
                    + "." + getFileExtension(mImageUri));
                    .addOnSuccessListener(taskSnapshot -> {
                        Toast.makeText(getActivity(), "Saved Succesfully", Toast.LENGTH_SHORT).show();
                                .addOnSuccessListener(uri -> {
                                    Upload upload = new Upload(uri.toString());
                                    String uploadId = databaseReference.push().getKey();
                                    Log.i("Link", uri.toString());
                    .addOnProgressListener(snapshot -> {
                        double progress = (100.0 * snapshot.getBytesTransferred() / snapshot
                        progressDialog.setMessage("Uploaded " + (int) progress + "%");
                    .addOnFailureListener(e -> {
                        Toast.makeText(getActivity(), "Error Ocurred" + e.getMessage(), Toast.LENGTH_SHORT).show();


Upload.Java //Model class

public class Upload {
    private String mImageUrl;

    public Upload() {


    public Upload(String imageUrl) {
        this.mImageUrl = imageUrl;

    public String getmImageUrl() {
        return mImageUrl;

    public void setmImageUrl(String mImageUrl) {
        this.mImageUrl = mImageUrl;


See to resolve your issue it needs to be debug few things then and then only you will able to resolve the issue.Also you need to clarify at which point what happen.You can try below things to get solution.

1..Put Log or Toast inside for loop while adding url to the mUploads list.Like toasting upload.getmImageUrl() and check is it giving you right http image url or not.

2.Put Log or Toast before the loading image url by Picasso.Like toasting uploadCurrent.getmImageUrl() and check is it giving you right http image url or not.

If error occuerd while toasting this put toString(); at the end. After that you will get better idea to resolve the issue.

EDIT: In above all case if you are getting right url then the problem is with Picasso library.You can try Glide to load the image.For that add

implementation 'com.github.bumptech.glide:glide:4.12.0'

annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

and then in side onBindViewHolder load image like this.