I am just making some AppWidget and I want to pass some Strings
through UpdateView to an Activity. But the Bundle is null.
I try this:
-Widget.java
Intent defineIntent = new Intent(context,
Visor.class);
defineIntent.putExtra
("org.rss.androides.post2","artist");
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, defineIntent, 0);
updateViews.setOnClickPendingIntent
(R.id.widget, pendingIntent);
-Viewer.java
Bundle b = intent.getExtras();
if (b == null) {
finish();
return;
}
b is always null.
putExtra error on AppWidget - Android Developers | Google Groups - 0 views
-
-
Remember that PendingIntents aren't keyed using extras: http://groups.google.com/group/android-developers/msg/b296f43ae70c4587 You could hack the extras through by mangling them into Uri parameters, or if you're using a ContentProvider, just point to a specific row.
-
Or use PendingIntent.FLAG_UPDATE_CURRENT; just be careful that each active instance has its own unique Intent.
详解 Android content provider - 0 views
1 - 10 of 10
Showing 20▼ items per page