public Bitmap GetBitmap (String url) {<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
/ / 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 here to jump directly to the
outofmemoryerrorreturn bmp;
} Catch (Exception e) {
return null;
}
catch (OutOfMemoryError e)
{
return null;
}
}
Reply:
Incidentally seeking several file handling classes, http handler class and a large picture processing class.

Reply:
Nobody?

Reply:
You first save it to the local, and then operate
Reply:
Overclocking. . .

Reply:
Either directly read or downloaded directly to the local memory errors are reported
Reply:
You use the simulator tests, or tests with real machine?
Reply:
Reported memory errors is because you want to load images too (general phone loaded more than 900 K when the picture will appear in this issue), this situation is nothing that a good way to appear only through the compression image size or reduce the resolution to resolve
No comments:
Post a Comment