I've changed the call to
 PendingIntent pending = PendingIntent.getActivity(context,
appWidgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Now everything is cool except based on discussions i'm not sure how
reliable it'll be . ( Doc says it's not supported yet )

On May 22, 2:01 pm, EboMike <ebom...@gmail.com> wrote:
> There are several discussions about PendingIntents in this group,
> they're a bit confusing at first because the system identifies them
> only by action and data, not extras, so multiple PendingIntents with
> the same action and data are considered the same.
>
> You need to make them unique, either by having unique actions or
> unique data. One of the solutions mentioned in one the threads about
> PendingIntents is to create a custom: data with the current system
> time in it.
>
> On May 22, 11:41 am, Alexey Volovoy <avolo...@gmail.com> wrote:
>
> > Then i've tried PendingIntent.FLAG_UPDATE_CURRENT i'm no longer
> > crashing, but it always launches the activity with extras were put in
> > the widget that was updated the last. It looks like pending intent is
> > shared among my widget instances . Anyway to avoid that  ?
>
> > On May 22, 12:36 pm, Alexey <avolo...@gmail.com> wrote:
>
> > > Hi All ,  i'm working on news feed widget ( looking at Sky as an
> > > example )
> > > Everything seems to be working except when i have more than one Image
> > > and click on the widget i'm crashing.
> > > One widget is working fine and more than one widget are working fine
> > > too as long as i don't try to launch pending intent.
> > > some code :
> > > in buildUpdate
> > >                 Intent intent = new Intent(context, StoryActivity.class);
> > >                 intent.putExtra("CategoryID", catID);
> > >                 intent.putExtra("StoryID", nItem.Number);
> > >                 Log.d(TAG, "UpdateIntent:" + nItem.Number);
>
> > >                 PendingIntent pending = 
> > > PendingIntent.getActivity(context, 0,
> > > intent,PendingIntent.FLAG_CANCEL_CURRENT);
> > >                 views.setOnClickPendingIntent(R.id.widget, pending);
>
> > > crash :
>
> > > 05-22 12:31:05.483: ERROR/AndroidRuntime(15473): Uncaught handler:
> > > thread main exiting due to uncaught exception
> > > 05-22 12:31:05.534: WARN/AudioFlinger(35): write blocked for 94 msecs
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):
> > > android.widget.RemoteViews$ActionException: android.app.PendingIntent
> > > $CanceledException
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.widget.RemoteViews$SetOnClickPendingIntent$1.onClick
> > > (RemoteViews.java:153)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.View.performClick(View.java:2179)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.View.onTouchEvent(View.java:3828)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.View.dispatchTouchEvent(View.java:3368)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:831)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > com.android.internal.policy.impl.PhoneWindow
> > > $DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
> > > (PhoneWindow.java:1197)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.app.Activity.dispatchTouchEvent(Activity.java:1993)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > com.android.internal.policy.impl.PhoneWindow
> > > $DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.os.Handler.dispatchMessage(Handler.java:99)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.os.Looper.loop(Looper.java:123)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > android.app.ActivityThread.main(ActivityThread.java:3948)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > java.lang.reflect.Method.invokeNative(Native Method)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > java.lang.reflect.Method.invoke(Method.java:521)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> > > (ZygoteInit.java:782)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
> > > 05-22 12:31:05.753: ERROR/AndroidRuntime(15473):     at
> > > dalvik.system.NativeStart.main(Native Method)
>
>
--~--~---------~--~----~------------~-------~--~----~
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