问题
I'm trying to create my first widget.
I run the app through eclipse, and it launches fine.
But when I try to add the widget from the widgets menu to the home screen I get a toast that says:
App isn't installed
When I look at the logcat I see this error:
05-15 18:35:10.533: E/Launcher(851): Error: appWidgetId (EXTRA_APPWIDGET_ID) was not returned from the \widget configuration activity.
I don't have a configuration activity at all, and as far as I understood from the developer's site, it's not a must.
回答1:
You need to put EXTRA_APPWIDGET_ID
in result intent like this:
setResult(RESULT_OK, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId));
来源:https://stackoverflow.com/questions/16569474/cant-add-the-widget-to-the-home-screen-app-isnt-installed