简体   繁体   中英

How to handle orientation changes for home screen app widget?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM