I'm trying to add multiple Views to a ViewFlipper, which is in an AppWidget (a Homescreen Widget). Here is my code:
for (Item item : list) {
RemoteViews rv = new RemoteViews(getPackageName(),
R.layout.widget_item);
rv.setTextViewText(R.id.txtTitle, item.getTitle());
Intent launchIntent = new Intent(this, ActItemViewer.class);
launchIntent.putExtra("id", item.getId());
PendingIntent pendingIntent = PendingIntent.getActivity(
this, id, launchIntent, 0);
rv.setOnClickPendingIntent(R.id.txtTitle, pendingIntent);
views.addView(R.id.viewFlipper, rv);
}
This code works fine, all items are shown in my widget. But when I click on an item in the ViewFlipper, ActItemViewer is always opened with the same "id". So I think that only the first PendingIntent is set.
Is there any way to have different onClick-Events for every Child in the ViewFlipper? I have seen some Widgets, that have this functionality, for example the "Spiegel Online"-Widget (german), or the Market-Widget.