I know there is lots of question regarding the same problem and i have tried many solution like this but i am still getting the empty string. here is my code
try {
URL url = new URL(myUrl);
InputStream in = url.openConnection().getInputStream();
BufferedInputStream bis = new BufferedInputStream(in,1024*8);
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len=0;
byte[] buffer = new byte[1024];
while((len = bis.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
out.close();
bis.close();
byte[] data = out.toByteArray();
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
d = new BitmapDrawable(getResources(), bmp);
} catch (FileNotFoundException e) {
d = getResources().getDrawable(R.mipmap.background);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
myUrl is firebase storage url