Reputation: 4967
can anybody give example how to implement click event in appwidget in android ?
Thanks
Upvotes: 0
Views: 430
Reputation: 139
Intent intent = new Intent(context, Activity.class);
Uri widgetId = Uri.parse("" + appWidgetId); // this line means
intent.setData(widgetId); // you can send a widget id
PendingIntent pintent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.clickButtoninWidget, pintent);
return views;
Upvotes: 0
Reputation: 34026
You can use RemoteViews.setOnClickPendingIntent(R.id.view_id, intent) method
for handle click event of app-widget. For more information you can refer below link
Upvotes: 1
Reputation: 69238
Use RemoteViews.setOnClickPendingIntent(R.id.view_id, intent) method. The intent parameter should be a well formed Intent object which would match on of the filters at your manifest file.
Upvotes: 0