Is Android Widget ID persistent

て烟熏妆下的殇ゞ 提交于 2020-01-04 04:26:13

问题


Is the widget id that you receive from the OS for a specific instance of your widget on the users desktop consistent until that instance of the Widget is deleted from the desktop? I can't find any documentation that definitive says that it is, but I am assuming that it is because the documentation says you can use the widget id to store any instance configuration information.

I want to store some configuration info into a database and tie it to a widget id as the unique reference. So that when a phone is rebooted I can lookup the previously saved off configuration for that instance based on the widget id and populate it in onUpdate.

Thanks for the help!


回答1:


Widget ids change only when you add the widgets on your home screen. You can remove the widget from your home screen and add it again. In this case your widget's id will be different.



来源:https://stackoverflow.com/questions/7086564/is-android-widget-id-persistent

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