Android AppWidget:创建实例时的方法回调?
每次创建小部件实例时,似乎没有调用 AppWidgetProviders 的方法。有人知道是否有办法做到这一点?类似于 onDelete() 但用于创建?
There doesn't seem to be a method for AppWidgetProviders that gets called every time an instance of the widget gets created. Anyone know if there is a way to do this? Something similar to onDelete() but for creation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您没有设置配置活动,则在创建新的应用程序小部件时将调用 onUpdate。
如果您确实设置了配置活动,则在创建新的应用程序小部件时不会调用 onUpdate,但仅在更新时调用。
请注意,阅读文档总是有帮助的,尤其是在处理诸如应用程序小部件之类的东西时 - 很多错误正在等待着您。从我的错误中吸取教训:(
If you didnt set a configuration activity, onUpdate will be called when a new app widget is created.
If you did set a configuration activity, onUpdate won't be called when a new app widget is created, but only on updates.
Note that reading documentation always helps, especially when messing with stuff like app widgets - alot of mistakes lay waiting for you. Learn from my mistake :(