Hi, all.
I saw this topic and implement IntentService as describes, but what if I want more that one button? How can I distinguish button from each other? I'm trying to setFlags, but cannot read it at onHandleIntent() method:
public static class UpdateService extends IntentService {
...
@Override
public void onHandleIntent(Intent intent) {
ComponentName me = new ComponentName(this, ExampleProvider.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(me, buildUpdate(this));
}
private RemoteViews buildUpdate(Context context) {
RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.main_layout);
Intent i = new Intent(this, ExampleProvider.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
updateViews.setOnClickPendingIntent(R.id.button_refresh, pi);
i = new Intent(this, ExampleProvider.class);
pi = PendingIntent.getBroadcast(context, 0, i, 0);
updateViews.setOnClickPendingIntent(R.id.button_about, pi);
return updateViews;
}
}
At this little piece of code I have two PendingIntent linked with setOnClickPendingIntent, can I distinguish this intent for different actions and processing? Thanks for help