无法将小部件添加到主屏幕-未安装应用 [英] Can't add the widget to the home screen - App isn't installed
问题描述
我正在尝试创建我的第一个小部件.
我通过Eclipse运行该应用程序,并且启动正常.但是,当我尝试将小部件菜单中的小部件添加到主屏幕时,我看到了一个吐司:
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:
未安装应用
当我查看logcat时,会看到此错误:
When I look at the logcat I see this error:
05-15 18:35:10.533:E/Launcher(851):错误:\ widget配置活动未返回appWidgetId(EXTRA_APPWIDGET_ID).
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
:
You need to put EXTRA_APPWIDGET_ID
in result intent like this:
setResult(RESULT_OK, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId));
这篇关于无法将小部件添加到主屏幕-未安装应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!