Another case for ghost widget IDs was when there was not enough room on the home screen.
On one of my devices, I had over 80 of these ghost widget IDs at a time. As you might imagine, running an update for all of them was pretty slow.
You mention CM7, I guess that's 2.3?
I've long gotten into the habit of tracking widget IDs myself, adding new ones when the user confirms in the config activity, and removing in the widget's onDelete.
-- K
On Friday, February 1, 2013 11:31:54 PM UTC+4, Jake Colman wrote:
-- On Friday, February 1, 2013 11:31:54 PM UTC+4, Jake Colman wrote:
>>>>> "T" == TreKing <treki...@gmail.com> writes:
T> On Tue, Jan 29, 2013 at 10:51 AM, Jake Colman <jake....@gmail.com> wrote:
>> I am finding that, on occasion, after I delete my widget from my
>> homescreen the underlying Service that I use is still receiving
>> alarms and doing work. I do all my clean-up in onDisabled and do
>> nothing on onDeleted. Is it possible that onDeleted can be called
>> without an intervening call to onDisabled?
>>
T> You've verified that the method is definitely not being called? It
T> could be that it's being called and you have a bug, like not
T> deleting the correct alarm or something.
T> Also, if you're cleaning up a single instance, I think you should
T> use onDeleted. onDisable is for when there are no widgets at all
T> left and you need to clean up some shared state or something.
I am doing my clean-up in onDisabled since I only need to clean up after
the last widget is removed.
Under normal circumstances, when I remove the widget onDeleted fires
followed by onDisabled. In the following scenario I get screwed:
1) Press on homescreen to install the widget
2) Configuration activity is displayed. Press back arrow to exit.
3) On CM7 (my test phone) the "resize widget" activity is displayed.
Instead of pressing "OK", press back arrow. The widget is NOT
created.
In this instance, if I create another widget and delete it only
onDeleted is fired but onDisabled is not. It looks like Android thinks
that the first aborted instance is still there.
How can I protect against this scenario?
--
Jake Colman -- Android Tinkerer
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment