Last active
April 17, 2019 05:03
-
-
Save jirawatee/c5f20aee09dd997cbcdfd143c61d1a96 to your computer and use it in GitHub Desktop.
Firebase Storage - Download in memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void downloadInMemory() { | |
| //long ONE_MEGABYTE = 1024 * 1024; | |
| Helper.showDialog(this); | |
| imageRef.getBytes(Long.MAX_VALUE).addOnSuccessListener(new OnSuccessListener<byte[]>() { | |
| @Override | |
| public void onSuccess(byte[] bytes) { | |
| Helper.dismissDialog(); | |
| Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); | |
| mImageView.setImageBitmap(bitmap); | |
| } | |
| }).addOnFailureListener(new OnFailureListener() { | |
| @Override | |
| public void onFailure(@NonNull Exception exception) { | |
| Helper.dismissDialog(); | |
| mTextView.setText(String.format("Failure: %s", exception.getMessage())); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment