【发布时间】:2018-04-15 17:34:31
【问题描述】:
storageReference=storage.getInstance().getReference("images/"+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);
}
});
我该如何解决这个问题?
【问题讨论】: