开发者

Appwidget : Is there any ways to check whether the Appwidget is currently being displayed on Home screen?

Is there any ways to check whether the Appwidget is currently being displayed on Home screen or not?

The scenario is like this,

I have 4-5 app widgets on my homescreen. My Home screen has three workspaces and开发者_C百科 my widgets are distributed over these workspaces. Now my intention is to get the appwidget that is currently being displayed in my active workspace, i.e. facing the user.


You can have a tricky workaround on determining whether the widget is being displayed on one of the homescreens.

Create a SQLite DB table with AppWidget ID, Enabled_Flag, Update_dttm (toggle 0 for not being displayed and 1 for being displayed)

Override the OnEnabled method for your AppWidget. Everytime the OnEnabled is called toggle the Enabled_Flag = 1 for the AppWidget ID.

What is trickier and I do not have answer to is "How to determine which screen the AppWidget is being displayed on?"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜