Friday, February 28, 2014

Solving the big picture of how to download from the Internet?


 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 here to jump directly to the
outofmemoryerrorreturn bmp;
} Catch (Exception e) {
return null;
}
catch (OutOfMemoryError e)
{
return null;
}
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
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:
reference to the third floor tianyutaizi reply:
you first save it to the local, and then the operation

Either directly read or downloaded directly to the local memory errors are reported
Reply:
references, 5th Floor wyj23114 reply:
Quote: references to the third floor tianyutaizi reply:

You first save it to the local, and then the operation

Either directly read or downloaded directly to a local, are reported memory errors


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