Yeah i'm have this code , but i do need extras.
On May 22, 2:07 pm, snctln <[email protected]> wrote:
> I have been wrestling with this problem too, and not quite figured it
> out but I remember reading something that Jeff Sharkey said about
> widget pending intents not being able to store extras properly or
> something, but they do store uris properly... like you can see in the
> sky source
>
> http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/...
> // Connect click intent to launch details dialog
> Intent detailIntent = new Intent(context,
> DetailsActivity.class);
> detailIntent.setData(appWidgetUri);
>
> PendingIntent pending = PendingIntent.getActivity(context, 0,
> detailIntent, 0);
>
> views.setOnClickPendingIntent(R.id.widget, pending);
>
> the extras are never set, but setData() is called...
>
> good luck
>
> On May 22, 1:41 pm, Alexey Volovoy <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---