Han Whiteking Han Whiteking - 10 months ago 60
Android Question

Firebase Codelab Friendlychat Android Apps: how to get image instead of text

I send an image from the web app to my android app but i found the app crash immediately as soon as it gets the data. Your demo only showcase a simple text transaction between apps-web and android, but how about for the image what variables in the firebase class that I need to pay attention to? I need to display the image transferred to the text view. Does firebase has library to facilitate this? would you show some code example for easier understanding. I refer the code downloaded from this address https://github.com/firebase/friendlychat for your reference.

Answer Source

Found good reference for the study guide at https://firebase.google.com/docs/storage/android/download-files

The most simplest way i can even just use the ImageView to console out the image (.png, gif,jpeg, etc) in android. Here's the code tested,

FirebaseStorage storage = FirebaseStorage.getInstance();
                        storageRef = storage.getReferenceFromUrl(friendlyMessage.getImageUrl());//storage.getReferenceFromUrl("gs://<your-bucket-name>");
                                .using(new FirebaseImageLoader())

Thx for the excellent view and attention from firebase support!