Android:onAppWidgetChanged 似乎不存在
这是AppWidgetHost.startListening()
的描述:
开始接收onAppWidgetChanged 调用您的 AppWidget
我在任何地方都找不到任何对这个神秘的 onAppWidgetChanged
事物的引用。唯一的谷歌点击是来自同一篇文档的引用。
它实际上指的是什么?需要调用、覆盖或实现什么来获取小部件更新?
This is the description of AppWidgetHost.startListening()
:
Start receiving onAppWidgetChanged
calls for your AppWidgets
I can't find any reference to this mysterious onAppWidgetChanged
thing anywhere. The only Google hits are quotes from the same piece of documentation.
What is it actually referring to? What does one need to call, override, or implement to get widget updates?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不太可能需要自己实现 Widget 主机。主页是现有的 Widget Host。您最有可能要做的是实现一个 WidgetProvider ,这基本上意味着扩展 android.appwidget.AppWidgetProvider 并覆盖两个方法:
onUpdate() 和 onReceive() 有时也会在 onEnabled 上。您几乎不需要实现 Widget 主机,但如果这是您的目标,请澄清。小部件提供程序本质上是一个广播接收器,旨在在小部件主机(通常是家庭)内运行。小部件提供程序可能仅存在几毫秒,以处理广播事件,并且处理其中一个事件是强制性的,并且必须在清单中指定。为了传达信息,小部件提供者(如任何广播接收器)扩展了上下文,并且可以发出 startActivity(intent) 或 startService(intent) 我认为这很可能是您需要做的,除非您确实正在实现小部件主机。
Its very unlikely that you need to implement a Widget host yourself. The home page is an existing Widget Host. Most likely what you are looking to do is Implement a WidgetProvider which basically means extending android.appwidget.AppWidgetProvider and overriding two methods:
onUpdate() and onReceive() some time onEnabled too. You almost never need to implement a Widget host, but if this is your goal please clarify. The widget provider is essentially a broadcast receiver which is designed to run inside widget host (usually home). The widget provider might live for only milliseconds, to process the broadcasted events and processing one of them is mandatory and must be specified in the manifest. To communicate out information the widget provider like any broadcast receiver extends context and can issue startActivity(intent) or startService(intent) I think this is most likely what you need to do unless you really are implementing a Widget Host.