3

I'm trying to get an image from the firebase db and assign it to an imagebutton to preview it but i get the fail "resolveUri failed on bad bitmap uri" Here my related codes:

var_resim2=dataSnapshot.child("user_resim").getValue().toString(); 
Uri my_resim = Uri.parse(var_resim2);
kul_resim.setImageURI(my_resim); 

What do i do wrong?

Chris Elvis
  • 43
  • 1
  • 6

1 Answers1

4

using Picasso lib is the best way : add this to your gradle

compile 'com.squareup.picasso:picasso:2.5.2'

then

Picasso.with(this).load(var_resim2).into(kul_resim);

or you need to download and then set it to the ImageView

Oussema Aroua
  • 5,225
  • 1
  • 24
  • 44
  • Omg. i just realised your answer to this and i tried what you say and Bam! It worked! But thanks to my curiosity i couldn't help my self not asking this questions; if it is so easy why do they try to do it by the other way i mean downloading the object from the url and setting it as a drawable item and then settin it to the image button. If there is such an easy way as Ousemma Aroua adviced . – Chris Elvis Jul 15 '17 at 09:48
  • Also what else we can do with Picasso Library :) I'm so excited! – Chris Elvis Jul 15 '17 at 09:50