Sure, this is easy to do.  If you have a Button in your target layout
passed to new RemoteViews(), you can call
RemoteViews.setOnClickPendingIntent() to trigger firing of the given
PendingIntent when people click on your button.  You could also use
any View, not just Button.

Here's how the Music widget is connecting up its buttons:

http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MediaAppWidgetProvider.java;hb=cupcake#l161

j

On Wed, May 6, 2009 at 7:38 AM, 6real <[email protected]> wrote:
>
> Dear all,
>
> I try to create a widget and I am now wondering how to be able to put
> a button on my widget and set its "onClickListener".
>
> It seems that we are limited to the RemoteViews... OK I can deal with
> that (but this is a limitat to me) but I'd like to add a button where
> the user can request an update on the data displayed in the widget. (I
> get some info on the web but the user only needs to request an update,
> I can't defined an automatique update, it's useless for my app)
>
> I'm sure we can do that since there is an example with a player and
> obviously with a PLAY/PAUSE button.
>
> I was looking for in the remoteViews API btu without finding
> anything...
>
> Can you please give me the direction where to find the way of doing...
> Thanks a lot for your help
> >
>



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