downloading a big bitmap from a server with no answer. I ran into this
problem myself and I was forced into look deeper in the API, specially
the Bimap.
When doing the downloading of the image insert this code:
Bitmap = null;
BitmapFactory.Options opts = new BitmapFactory.Options
();
URLConnection conn = (HttpURLConnection) new URL("your
url for the image").openConnection();
conn.connect();
final BufferedInputStream bis = new BufferedInputStream
(conn.getInputStream());
opts.inSampleSize = 4;
bm = BitmapFactory.decodeStream(bis, null, opt);
The key one is the Options in which you can reduce the number of
pixels resulting in a smaller image with the .inSampleSize = 4 , the
number is to be divided for the size of the image, preferably an even
number.
http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inSampleSize
Hope this can help anyone facing the same problem I did.
Cheers
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment