Check Widget is Placed on Android Screen
问题 Can someone tell me how to check that my widget have been placed on the homescreen? I have some code in my app that should run only if the widget is placed on the homescreen. 回答1: You need to store that information yourself. I usually use the application preferences, but you could use anything. Generally widgets use services to communicate, so your code that does stuff is likely in a service, but using the preference allows any portion of your app to access this. In your widget class that