Tuesday, July 19, 2011

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

On Tue, Jul 19, 2011 at 8:55 AM, shubh <shubhampatni86@gmail.com> wrote:
> hi, I want to called method on press of Widget Button.

That is not possible.

> but i am not getting any way to call direct method on click of widget
> 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 a widget in an app
widget. Put your business logic in the SendToRecent service.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://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