How to handle orientation changes for home screen app widget?

﹥>﹥吖頭↗ 提交于 2019-12-11 23:32:09

问题


Can anyone help me on how to handle orientation change for app widget? On orientation change my widget is showing layout with empty view and removing all listeners.


回答1:


After research and studying some of the folks answers , I came to know the mistake i have done.

After initial setup of the widget , I am again initializing remote views and trying to change only few views like when user taps on refresh button , iam making that view visibility gone and making circular progress loading view visibility visible and not again adding all other views and click listeners i am updating the widget.

Appwidget manager will use last remote views object. So whenever orientation changes Appwidget manager is trying to load the latest remote view object by ignoring all the pending intent listeners and views.

I resolved this by creating remote view object with all my required view and listeners.



来源:https://stackoverflow.com/questions/18448405/how-to-handle-orientation-changes-for-home-screen-app-widget

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