Well I guess the talk was referring to general widgets (custom views
that can be used on other views) and not appWidgets (homescreen
widgets)

After spending many more hours trying to get something to work I am
once again abandoning my hopes for having more information about the
fully rendered size of appWidgets, its a shame, because I would like
to do custom drawing in my code and it would be great it I could work
with a canvas that is the same size as the end result instead of one
that will eventually be scaled, thus making the clarity and precision
of the image worse.

So I am giving up on this hope, but I am very open to hearing any
further thoughts or ideas on this subject

---snctln
www.snctln.com

On May 29, 9:47 pm, snctln <catlin.s...@gmail.com> wrote:
> 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 <romain...@google.com> 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 <catlin.s...@gmail.com> 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
> > romain...@android.com
>
> > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to