StorageException已发生。对象在位置不存在?

问题描述 投票:0回答:1

storageReference = storage.getInstance()getReference( “图像/” + homeClass.getHomeId()+ “JPG”)。;

     final long ONE_MEGABYTE = 1024 * 1024;
     storageReference.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() {
        @Override
        public void onSuccess(byte[] bytes) {
            Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);

                imageView.setImageBitmap(Bitmap.createScaledBitmap(bmp,imageView.getWidth(),
                    imageView.getHeight(), false));
            holder.progressBar.setVisibility(View.GONE);
        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception exception) {
            // Handle any errors
            Toast.makeText(c.getApplicationContext(),"Unable to show picture",Toast.LENGTH_SHORT);
            holder.progressBar.setVisibility(View.GONE);
        }
    });

我怎么解决这个问题?

android firebase
1个回答
0
投票

查看reference网址并获取imageRef

// Create a storage reference from our app

StorageReference storageRef = storage.getReference();

// Create a child reference
// imagesRef now points to "images"

StorageReference imagesRef = storageRef.child("images");

// Child references can also take paths
// spaceRef now points to "images/space.jpg
// imagesRef still points to "images"

StorageReference spaceRef = storageRef.child("images/"+homeClass.getHomeId()+".jpg");

我希望这能帮到您。

© www.soinside.com 2019 - 2024. All rights reserved.