onDeleted method not firing up when appwidget is deleted

为君一笑 提交于 2019-11-28 09:24:02

问题


The onDeleted method is not firing when an appwidget is deleted from the home screen.

What could be the problem?


回答1:


This seems to be a somewhat common problem with Android widgets.

If you are subclassing AppWidgetProvider, onDelete() is liable not to get called. In order to work around this, you can instead implement the onReceive() method and explicitly look for APPWIDGET_DELETED.

References:
- https://groups.google.com/forum/?fromgroups=#!topic/android-developers/Nl0e06rDCRY - http://blog.elsdoerfer.name/2009/06/03/writing-an-android-widget-what-the-docs-dont-tell-you/



来源:https://stackoverflow.com/questions/12385780/ondeleted-method-not-firing-up-when-appwidget-is-deleted

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