views:

23

answers:

1

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 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.

A: 

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?"

Aakash