Hi all,

I've been developing my home screen widget for a week or two now and during
last few days I encountered an interesting error. First about my widget, I'm
handling my own broadcast messages in onReceive method, looks like this:

public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
/* handling of my intents follows */
}

I don't really use onUpdate method since I'm updating widget content on
demand, so I finally put this into the onUpdate method (I was trying to
debug the code):

public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds){
Log.d("number of ids",new Integer(appWidgetIds.length).toString());
}

Provider's XML looks like this:

<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android";
android:minWidth="318dp"
android:minHeight="78dp"
android:initialLayout="@layout/widget"
 android:configure="blah.WidgetConfigurationActivity"
updatePeriodMillis="0"
>
</appwidget-provider>

(I have some interesting question(s) about the width and height fields, but
that's another case.)
And to clear the other thins, the only moment I send an Intent from my main
application to the widget is on user demand (user clicks some button). Now
about the error - when I deploy the application to the emulator from
Eclipse, my onUpdate method gets called with appWidgetIds with length about
119 (has been 120 lately). If I understand this correctly, that would mean
my widget provider should handle more than 100 widget instances even when
there are none? I don't remember changing anything that could affect this
(and I don't really know what even could). Anyone got some thoughts or
proposals about this?

I'm actually wondering why is the onUpdate method getting called on
application deploy too (it shouldn't imho, at least I don't see any real
reason). I've tried to solve that for a day or two, but I wasn't able to
make any improvements. I came up with some possible workarounds, but I don't
really feel good about them.

Thanks a lot for all your replies.
Filip Havlicek

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

Reply via email to