问题
Seems this has been a pain for some time now (did quite a bit of research in SO and on the net)
In a nutshell the android documentation states:
- onReceive will be called before every other lifecycle method calls
- onDeleted will be called when a widget is removed
- onDisabled will be called when the last widget is deleted
Well, when deleting a widget neither onReceive nor subsequently onDeleted is being called. Similarly, when the last widget is removed the code does not reach to onDisabled either.
1. This has been an issue since android version 1.5 and continues to be up to now.
Android developers at Google, what was the reason of not fixing this after over 10 major releases?
To everybody else...
Is there any workaround for this regardless how ugly it might be?
Excuse my frustrated tone.
来源:https://stackoverflow.com/questions/12812234/ondeleted-ondisabled-are-not-being-called-at-all-when-removing-an-android-widge