Ciao Simone,

probably it's stupid to ask this, but just to be sure: have you called
updateAppWidget() after setting the RemoteViews object? Like this:

appWidgetManager.updateAppWidget(appWidgetId, remoteViews);



Yuvi


On Sun, Sep 19, 2010 at 4:57 PM, Simone <[email protected]> wrote:

> I have a simple widget (whose entire layout is just an ImageView) that
> starts and stops a service. From within the service, I'd like to
> switch the image displayed by such ImageView.
> So, i did this:
>
> public int onStartCommand(Intent intent, int flags, int startId){
>        RemoteViews remoteViews = new RemoteViews(getPackageName(),
> R.layout.main);
>        remoteViews.setImageViewResource(R.id.imgView, R.drawable.image1);
>
>        ...
>        ...
>
>        return START_STICKY;
> }
>
> and
>
> public void onDestroy(){
>        RemoteViews remoteViews = new RemoteViews(getPackageName(),
> R.layout.main);
>        remoteViews.setImageViewResource(R.id.imgView, R.drawable.off);
>
>        ...
>        ...
> }
>
> But it doesn't work.  onStartCommand and onDestroy are called, but the
> image doesn't change.
> What gives?
> Simone
>
> --
> 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]<android-developers%[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

Reply via email to