Set the desired density of your bitmap:
http://developer.android.com/reference/android/graphics/Bitmap.html#setDensity(int)

On Fri, Feb 17, 2012 at 12:56 PM, YuviDroid <[email protected]> wrote:

> Hi,
>
> sorry to resurrect this post...but I got into a similar problem. And as
> the OP did, I'm using RemoteViews.setImageViewUri() to set my image on the
> appwidget. However I noticed that my image is being scaled according to the
> screen density.
>
> So, for example, on an XHDPI screen, if I have a bitmap which is 100x100
> and I set it using setImageViewBitmap() I get the image to look as 100x100.
> However, if I store that bitmap into a png on disk, and then use
> setImageViewUri() my bitmap is displayed as 50x50.
>
> Do you know if there is a way to change this behavior? (i.e. if my image
> is 100x100 I'd like it to remain 100x100 also after it is decoded).
> Maybe there is a way to force some density on the ImageView itself?
>
> My only workaround (which sucks..) is to scale-up the bitmap before
> storing on disk so that when it is being decoded I get back my original
> size. But in this way I use more memory to save the image and I also loose
> image quality..:(
>
> I hope someone can help me!
> Thanks,
> Yuvi
>
> On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell <[email protected]>wrote:
>
>> Thanks Kostya and Dianne, setUri works as expected.  I had to create the
>> files using context.openFileOutput.  Unfortunately that means I loose the
>> ability to use directories.  I can't see a "Java" way to set permission on
>> files, it can be done with native methods, but that seems like overkill.
>>  I'll do some more googling.
>>
>> Thanks again for the help, I was worried that this problem might have
>> been a show-stopper.
>> Ash
>>
>>  --
>> 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
>>
>
>
>
> --
> YuviDroid
> Check out Launch-X <http://android.yuvalsharon.net/launchx.php> (a widget
> to quickly access your favorite apps and contacts!)
> http://android.yuvalsharon.net
>
>  --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to