简体   繁体   中英

Can't add the widget to the home screen - App isn't installed

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.

您需要将EXTRA_APPWIDGET_ID放入结果意图中,如下所示:

setResult(RESULT_OK, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM