To solve how to download large image from the web?

	public Bitmap GetBitmap(String url) {
// return BitmapFactory.decodeStream(httphelper.GetStream(url));
try {
URL Url = new URL(url);
HttpURLConnection conn = (HttpURLConnection) Url.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream inputStream = conn.getInputStream();
BitmapFactory.Options options = new Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(inputStream, null, options);
int zoom = 10;
options.inJustDecodeBounds = false;
options.inSampleSize = zoom;
Bitmap bmp = BitmapFactory.decodeStream(inputStream, null, options);
//Run to here and jump to outofmemoryerror.
return bmp;
} catch (Exception e) {
return null;
}
catch(OutOfMemoryError e)
{
return null;
}
}

Started by Jo at February 10, 2016 - 9:54 AM

Get a few file class, HTTP class and big picture processing class.

Posted by Jo at December 13, 2016 - 7:19 AM

No one yet?

Posted by Jo at December 21, 2016 - 8:14 AM

Before you save it to local, then the operation

Posted by Ronald at December 26, 2016 - 8:15 AM

Overclocking. . .

Posted by Fabian at December 27, 2016 - 8:36 AM

Whether it is directly read or download directly to local, are reported memory errors

Posted by Jo at January 07, 2017 - 8:48 AM

You use the simulator to test, or with the real machine test?

Posted by Edwiin at January 07, 2017 - 9:23 AM

Daily memory error because you want to load the picture too big (general mobile phone when loading more than 900 K of the pictures will appear in this issue), appear this kind of circumstance is not what good method, can only through the compressed image size or reduce the resolution to solve

Posted by Brent at January 08, 2017 - 8:44 AM