Remember that widget RemoteViews updates are applied over a
potentially-cached layout.  You should always set all values on each
update you send.  For example, if the last update you passed only
updated a TextView, that single update could potentially be applied
over the top of a brand new layout (such as after an orientation
change).

j


On Sun, Nov 29, 2009 at 3:20 AM, Ryan <[email protected]> wrote:
> Ok I think I figured it out. In certain cases when the widget is
> clicked i updated the RemoteViews to hide some on screen controls/
> views using setViewVisibility on the remoteview, however I did not re-
> set the setImageURI. When the screen rotated the Image dissappeared.
> However this is odd because I would expect the image to dissappear on
> updating the RemoteView without the ImageURI even without rotating the
> screen. But it would only dissappear after rotating. When I did not go
> through the routine that hid the controls/ did not set the
> setViewVisibility, the image did not dissappear on rotation.
>
> I am curious as to what happens to the RemoteView on orientation
> change and why sometimes it seems to retain the ImageURI and others it
> loses it.
>
> In any case I have my workaround.
>
> - Ryan
>
> On Nov 28, 12:12 am, Ryan <[email protected]> wrote:
>> I am building an appwidget that is displaying images from the sdcard.
>> I am investigating how to get the appwidget to perform correctly on an
>> orientation change. Currently I am setting the image on an image
>> button in the remoteview from a Bitmap I created in the program.
>> However it seems that when the orientation changes this bitmap is
>> destroyed and the image won't display unless I update the remoteview
>> of the appwidget after the orientation change.
>>
>> What should I do so that when the appwidget is remade after
>> orientation change the image is able to be redisplayed automatically?
>> The only thing I can think of is using a setImageViewURI() to point
>> the remoteview to the image file itself using a URI (I am having
>> issues getting this to work correctly thus far).
>>
>> It seems that none of my code is excecuted on this orientation change
>> as it is only rebuilding the remoteview. Is there an accepted practice
>> here? Thanks,
>>
>> - Ryan
>
> --
> 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
>



-- 
Jeff Sharkey
[email protected]

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