Does anyone else have any ideas on this?

I would really like to be able to know the size of that the bitmap
from the imageView is being scaled to so that I can optimize some code
similarly to what Romain mentioned in the article I referenced in the
OP.

Currently I read the minWidth and minHeight values from an
AppWidgetProviderInfo object, but I know that these are just the
values declared in the xml for the AppWIdgetProvider.

So is there anyway to access a cached bitmap object after the scale
has taken place or a way to listen for the scaling event that happens
to an ImageView in an AppWidget?

Any help would be greatly appreciated.

---Sean Catlin

On May 29, 1:06 am, Romain Guy <[email protected]> wrote:
> Hi,
>
> A way to do this is to use the onSizeChanged() method. In that method,
> you know what the exact size of your view is. From there you can
> easily call Bitmap.createScaledBitmap() to scale your bitmap down.
>
>
>
> On Thu, May 28, 2009 at 11:00 PM, snctln <[email protected]> wrote:
>
> > So I was just reading a great overview of some of the IO happenings
> > written by Mark Murphy and posted over athttp://androidguys.com/?p=5342
> > and was very intrigued by something... here is the relevant text
>
> > "Next, Romain moved into images, particularly backgrounds for widgets.
> > Backgrounds will always be fitted to the widget, and so Android may
> > have to scale your bitmap to fit the widget – however, scaling at
> > runtime is expensive. It is better, where possible to pre-scale the
> > image and use the scaled one in your layouts, rather than having
> > Android scale it on the fly. You can do this in Java code, via
> > Bitmap#createScaledBitmap(), and setting the widget background from
> > the cached scaled value."
>
> > From my understanding this is basically saying you can figure out the
> > end size of your widget by reading values cached bitmap object, but I
> > have no idea where to get this object.
>
> > When I started working with widgets I spent a lot of time trying to
> > figure out the dimensions of the widget but figured it was a lost
> > cause because my understanding was that RemoteView gets inflated after
> > you ever get a chance to work with the specific dimensions... it seems
> > this is still the case but a background bitmap is still cached
> > somewhere?  Where can I get a hold of that bitmap object?
>
> > I tried writing a proof of concept sample for myself, basically th
> > widget layout was a frame layout with a imageView set to fill parent
> > for both width and height... I created a bitmap of a small size
> > (40x40) and set the widgets image view to this bitmap via
> > removoteView.setImageViewBitmap(), i then went back to update the
> > widget 1 minute later and my bitmap object had not been scaled at
> > all...
>
> > Can anyone help me out with this?  Romain maybe?
>
> > I have a few ideas that require this ability so any help is appreciated
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  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