Make sure that ComponentName you use to get AppWidgetManager matches the
widget provider in the manifest. If it doesn't, you'll get an empty list
(ids.length = 0, the loop won't execute).

Not sure what you mean by "which widget coming".

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

21.09.2010 11:56 пользователь "Jerome Deng" <deng.jer...@gmail.com> написал:

Hi guys,
I have searched many topics about AppWidgetManager.getAppWidgetIds().
But I don't get any compellent answers. In my code, I first get all
widget ids by
AppWidgetManager.getAppWidgetIds(provider), and then do a for loop as
below:
for (int id : ids) {...}
However, I see the for loop never executed. And if I call ids.length,
the sentence never executed yet.

Some people said getAppWidgetIds() can not return the right id set,
that is because the some widgets were deleted but their ids are still
there.

My target is to know how many widgets are created by the specified
widget provider, so I think getAppWidgetIds() can meet this. But it
fails now.

I think getAppWidgetIds() has something wrong, and the widget
framework should fix this. Also, in widget provider, if it can
distinguish which widget instance is coming, that means the current
widget id can be passed in, then all things will be better. Why not do
this in widget framework?

--
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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@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 post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to