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. =)