Wednesday, July 20, 2011

[android-developers] Re: How to call any method on button event of widget?

Hi Mark, I did same , i put my business logic in SendToRecent (which
is my Service class), but here every time i have to start Service
class on click of widget Button.

So suggest me if have any other way to handle this.
I thing which i did after finishing my business logic in Service class
I called stopSelf() , is it proper solution?


On Jul 19, 6:03 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> On Tue, Jul 19, 2011 at 8:55 AM, shubh <shubhampatn...@gmail.com> wrote:
> > hi, I want to calledmethodon press ofWidgetButton.
>
> That is not possible.
>
> > but i am not gettinganyway tocalldirectmethodon click ofwidget
> >button.
>
> That is not possible.
>
> > Intent configIntent = new Intent(context, SendToRecent.class);
> > active.setAction(ACTION_WIDGET_CONFIGURE);
> > PendingIntent configPendingIntent = PendingIntent.getService(context,
> > 0, configIntent, 0);
> > remoteViews.setOnClickPendingIntent(R.id.btnResend,
> > configPendingIntent);
>
> Your code above is how you respond to a click on awidgetin an appwidget. Put your business logic in the SendToRecent service.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment