Thanks.  I bought a subscription to your books and have actually been
going through this code trying to figure it out.  If I understand
correctly this is the snippet of code that handles the refresh button:

public void onReceive(Context ctxt, Intent intent) {
    if (intent.getAction()==null) {
        ctxt.startService(new Intent(ctxt, UpdateService.class));
    }
    else {
        super.onReceive(ctxt, intent);
    }
}

What I'd like to do is expand this code to be able to handle three
different buttons.  However, I'm not sure how to do that.
Incidentally, that would be a great addition to this widget in your
book -- adding another button.  I'm not entirely sure what it would
do, but it would be nice to see an example of handling more than one
button press (that isn't a configuration app launcher).

Thanks for the books BTW.  They've been helpful.



On Sat, May 15, 2010 at 8:18 PM, Mark Murphy <[email protected]> wrote:
> Isaac Wagner wrote:
>> I'm creating my first widget and ran into a snag.  I have several
>> buttons on this widget and need a way to register an onClick action
>> for each of the buttons.  So far I've only found examples where they
>> start a configuration activity from a widget button.  Does someone
>> have example code on using buttons in home screen widgets?  Thanks.
>
> http://github.com/commonsguy/cw-andtutorials/tree/master/36-AdvAppWidget/LunchList/
> http://github.com/commonsguy/cw-advandroid/tree/master/AppWidget/TwitterWidget/
>
> The latter has two buttons, one that pops the configuration activity and
> one that refreshes the widget contents.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Consulting: http://commonsware.com/consulting
>
> --
> 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

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