Monday, March 5, 2012

[android-developers] Image on external storage

Hi,

I would like to display an image from external storage which is 72x72
px.
My device has high density.
The image view height and width are "wrap_content".

I got different results if I load the image or use an URL.

If I use an URL like this then the result will be about 48x48px.

imageView.setImageURI(Uri.fromFile(file));

If I load the bitmap the result is 72x72 px as expected:

InputStream is =
context.getContentResolver().openInputStream(Uri.fromFile(file));
Bitmap b = BitmapFactory.decodeStream(is, null, null);
is.close();

iv2.setImageBitmap(b);

You can see the results here:

http://dl.dropbox.com/u/51679071/share/facebook.png

It would be better if I could use the setImageURI and not to preload
the image
and I would like to display the image in appwidgets too.

Can you tell me what cause the difference and how can I avoid it?

Thanks,
Tamas

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate