Romain,

Thank you very much for the quick response I really appreciate it.

This sounds like a very reasonable approach to this problem, but
unfortunately I am still confused.  I apologize in advance, because I
am sure this is a simple concept that I am just not understanding at
the moment...

Before I go any further I figure I should explain my basic widget
update procedure

I do it all in a service at the recommendation of jsharkey to avoid
ANR dialogs, my service runs somewhat like this

- grab an instance of the appWidgetManager
- get all of the appWidgetIds for my widget
- start loop over these ids
-- create a new RemoteView object from the widget Id and my xml Layout
which is just a frameLayout and an ImageView
-- set the imageView bitmap via RemoteViews.SetImageViewBitmap()
-- update the widget via appWidgetManager.updateAppWidget
- end loop

So usually when I want to get ahold of a view I do a findViewById in
an activity, but since I am doing this from a service I didn't think I
had access to this method.

Where do I access the actual ImageVIew being used so that I can get
access to the onSizeChanged method?  Or am I thinking about this all
wrong?

Thanks again for the quick response, I am looking forward to anything
else you can help me with on this matter.

---snctln
- end loop

So I can use teh onSizeChanged() method to see when the bitmap gets
scaled... I assume this is for the image View?





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