Solved.. 1) Reset the emulator with following command: emulator -avd -TestDevice -wipe-data This clears all the AppWidget that were in the memory.
2) Next followed the following tip from Android docs to avoid the above thing from happening: *Tip:* When your configuration Activity first opens, set the Activity result to RESULT_CANCELED. This way, if the user backs-out of the Activity before reaching the end, the App Widget host is notified that the configuration was cancelled and the App Widget will not be added. Regards, Mahavir On Sun, Mar 13, 2011 at 5:28 PM, Mahavir <[email protected]> wrote: > Hi All, > > I have AppWidget which runs fine but I want to do some cleanup task > when last appwidget is deleted. So according to android documents, I > implemented onDisabled() method in my AppWidgetProvider class.But when > i delete the last AppWidget, onDisabled is not getting called. > > When I implemented onDeleted() method, It gets called. I checked all > instance of my appwidgets using following code, > > AppWidgetManager > appWidgetManager=AppWidgetManager.getInstance(context); > > int[] allAppWidgets=appWidgetManager.getAppWidgetIds(new > ComponentName(context,MyWidgetProvider.class)); > > for(int i=0;i<allAppWidgets.length;i++) > > System.out.println("AppWidget==>"+appWidgetManager.getAppWidgetInfo(allAppWidgets[i]).toString()); > > It shows that it has got 11 instances of appwidget. But i cannot see > any instance of my appwidget except the one which i create. > > Does anyone knows how to delete all the instances of this invisible > AppWidgets? > > Regards, > Mahavir > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

