I have an application in which I need to download an image from a URL. For this, I use the following code:
URL url = new URL(address); URLConnection conn = url.openConnection(); conn.connect(); int length = conn.getContentLength(); is = conn.getInputStream(); bis = new BufferedInputStream(is, length); bm = BitmapFactory.decodeStream(bis);
Returned for some reason, bm has a height and width of -1, and this eliminates an exception from the illegal state. What could be the reason that the height and width are approaching -1?
source share