>>>>> "KV" == Kostya Vasilyev <[email protected]> writes:
KV> Mark -- KV> You left out what happens with 1338 receivers... :) KV> Jake -- KV> I implemented my two widget sizes as two receivers, the reason KV> being that <meta-data> that references the KV> widget_info_<widget_size_variation>.xml goes under KV> <receiver>. The metadata is important because it specifies KV> minimum widget size, which differs between my widgets (3x1 and KV> 2x1). Besides, that's how the home screen app knows that there KV> are two widgets. KV> Multiple broadcasts haven't been a problem with my setup, because KV> my code double checks widget Ids against my own known widget Id KV> list for that particular widget size. The list is maintained by KV> the widget configuration activity (add) and the receiver's KV> onDeleted (remove). KV> The update action never crosses into the wrong receiver, KV> apparently because it has the Java class name set. KV> And actually, this is one solution you could try. For your own KV> broadcast intents (I presume, triggering a widget update in KV> response to application logic) you can set the class name in the KV> intent, to make "large" broadcasts go to "large" receiver, and KV> "small" go to "small". KV> For intents broadcast by the system (if you widgets watch some KV> system state changes), you could implement just one receiver as KV> Mark recommends, and update both "large" and "small" widget KV> lists. KV> In my code I just let both sets of widgets update from their own KV> intent filters, each having the same system intents that I care KV> about. With the widget Id checking as descibed above, it affects KV> only widgets managed by that particular reciever. Kostya, Thanks for the detailed reply. For those events that are shared by the two receivers, what happens if only one sized widget is actually on the home screen? The system sends the event and it is still processed by "unused" broadcast receiver even though its widget is not instantiated? That's the behavior I am seeing and it sounds like you see the same. With regard to your statement "Multiple broadcasts haven't been a problem with my setup, because my code double checks widget Ids against my own known widget Id list for that particular widget size", you still get the multiple broadcasts but you are smart enough to ignore them? -- 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 [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

