I have the following method to display a bit map
InputStream is = null ;
try {
Bitmap bm;
is = getContext().getContentResolver().openInputStream(
uri);
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inJustDecodeBounds = true;
BitmapFactory.decodeStream(is, null, opt);
Display d;
WindowManager wm = (WindowManager) getContext
().getSystemService(
Context.WINDOW_SERVICE);
d = wm.getDefaultDisplay();
int h = d.getHeight();
int w = d.getWidth();
opt.inSampleSize = 1 ;
while ( (opt.outWidth/opt.inSampleSize) > w ||
opt.outHeight/opt.inSampleSize) > h) {
opt.inSampleSize <<= 1 ;
}
opt.inJustDecodeBounds = false;
bm = BitmapFactory.decodeStream(is, null, opt);
super.setImageBitmap(bm);
} catch (IOException e) {
//Error
}finally {
if (null != is) {
try {
is.close();
} catch (Exception e) {
//Can't do anything
}
}
}
It works fine for all(any Size) jpeg, png, bmp images.
But it always through a OutOfMemory exception for a GIF(single frame)
image larger than 5MB.
Has anybody faced this problem or is there a solution for this.
PS: I am using cupcake version of android.
Thanks,
With Regards
Muniraju
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---