0

I'm working right now with Firebase and I've found a problem while trying to get multiple pictures from Firebase Storage at the same time. The log shows something like -- threads 128 pool full...

I think this happens because I'm putting Firebase downloading pictures code in a loop, so that I can download all pics. See code below.

StorageReference islandRef = storageRef.child("images/island.jpg");

final long ONE_MEGABYTE = 1024 * 1024;
islandRef.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() {
@Override
public void onSuccess(byte[] bytes) {
    // Data for "images/island.jpg" is returns, use this as needed
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
    // Handle any errors
}
}); 

So after looking in stack for a solution, I discovered that I can download pictures via URL without Firebase's method and that will not open threads which is good, but now I don't know how to get an accessible URL via this method:

 url = new URL (storageRef.getDownloadUrl().toString());
                    bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

Thank you. =)

AL.
  • 36,815
  • 10
  • 142
  • 281
Amine boujida
  • 111
  • 1
  • 1
  • 6
  • 1
    Possible duplicate of [How to get an array with all pictures?](http://stackoverflow.com/questions/37335102/how-to-get-an-array-with-all-pictures) – Mike McDonald Jan 03 '17 at 16:06
  • Check out Zero to App (https://www.youtube.com/watch?v=xAsvwy1-oxE) and it's associated source code (https://gist.github.com/puf/f49a1b07e92952b44f2dc36d9af04e3c), which will show you how to do this :) – Mike McDonald Jan 03 '17 at 16:07
  • Sorry mike but I cant find the solution – Amine boujida Jan 03 '17 at 17:31

0 Answers0