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

眉间皱痕 提交于 2021-02-20 04:26:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!