I am facing the same problem with my RemoteViews in notification layout.  I 
cannot set multiple PendingIntents with different intent extras.  Is this 
still the case in 2016?  I am surprised they didn't fix it.

On Sunday, June 14, 2009 at 3:19:31 PM UTC-4, BoD wrote:
>
> Hi! 
>
> I'm making a little AppWidget that should be configured when you first 
> add it and also when you click on it. 
>
> I figured, since clicking on it should do the same as the "creation" 
> event, why not try to use the same code? 
>
> My configuration Activity should not know or care, whether it was 
> called for a creation event or an "already exists, wants to be 
> configured" event. 
>
> So I extend AppWidgetProvider, create a RemoteViews for my AppWidget 
> and do this in onUpdate(): 
>
>             Intent intent = new Intent(context, 
> ConfigureActivity.class); 
>             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
>             intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 
> appWidgetId); 
>
>             PendingIntent pendingIntent = PendingIntent.getActivity 
> (context, 0, intent, 0); 
>
>             views.setOnClickPendingIntent(R.id.buttonImage, 
> pendingIntent); 
>
>
> For some reason it's not working as I'd like: 
> in my ConfigureActivity when I look at getIntent().getExtras 
> ().extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID), it returns 
> always the same id: the first one that was configured. 
>
> Now the strange part: 
> if in the code above I add this line: 
>
>             intent.setData(ContentUris.withAppendedId(Uri.EMPTY, 
> appWidgetId)); 
>
> then it works correctly and in my ConfigureActivity getIntent 
> ().getExtras().extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) 
> returns the correct id, the id of the widget I clicked on. 
>
> Surely there is an explanation but I don't see it. 
> Please help! :) 
>
> Thanks a lot! 
>
> BoD

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/4c6f0801-a186-4abf-9ff2-0e0718143d6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to