Ok I get it!!!!

this is to do with (I think) how two *innocent* intents could be
deemed the same even if they are different owing to their *extras".

The uniqueness of intents when dealing with pending intents does not
take into account the "EXTRAS" but it does take into account the
"data" portion.

And hence the following code simulating this uniqueness by converting
an intent with extras first to a string (which will include the extras
as appended string) and then set that unique string as data URI. :) I
get it.

Hope this helps another **easily baffled**.

Satya

On Fri, Feb 25, 2011 at 2:35 PM, Satya Komatineni
<satya.komatin...@gmail.com> wrote:
> If you could take a look at this segment of code
>
>
> final Intent intent = new Intent(context, WeatherWidgetService.class);
> intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
>
> //********************************
> //what is done here???
> //********************************
> intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
>
> final RemoteViews rv = new RemoteViews(context.getPackageName(),
> R.layout.widget_layout);
> rv.setRemoteAdapter(appWidgetIds[i], R.id.weather_list, intent);
>
>
> This code is taken from:
>
> http://developer.android.com/resources/samples/WeatherListWidget/src/com/example/android/weatherlistwidget/WeatherWidgetProvider.html
>
>
> I understand what "toUri" does for an intent. However in this case
>
> 1. the intent is explicitly invoking a service component
> 2. The service component is free to choose the extra parameters from the 
> intent
> 3. If so why set the "data" to itself???
>
> Appeciate if you can throw some light on this
>
> Thanks
> Satya
>



-- 
Satya Komatineni
http://www.satyakomatineni.com
http://www.androidbook.com

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to