Bitmapfactory.decodestream Not Working
I'm having a bit of a problem with decodeStream returning null. It seems to be a fairly common problem around, but it's usually pinned down to one of two problems: An OutOfMemory
Solution 1:
Ultimately, the answer was found here, using an InputStream returned by a BufferedHTTPEntity. While it seems needlessly complex, I can only assume that simply getting a stream from the URL object directly doesn't return a stream of the appropriate type, and so it wasn't reading out all the data properly.
Cross-posting the code in case the question is erased:
privatestatic InputStream fetch(String address)throws MalformedURLException,IOException {
HttpGethttpRequest=newHttpGet(URI.create(address) );
HttpClienthttpclient=newDefaultHttpClient();
HttpResponseresponse= (HttpResponse) httpclient.execute(httpRequest);
HttpEntityentity= response.getEntity();
BufferedHttpEntitybufHttpEntity=newBufferedHttpEntity(entity);
InputStreaminstream= bufHttpEntity.getContent();
return instream;
}
Post a Comment for "Bitmapfactory.decodestream Not Working"