Also, why would it be better to have one handler than multiple handlers anyways given that in some situations multiple handlers can compile?
On Wed, Nov 30, 2011 at 1:32 PM, John Goche <[email protected]>wrote: > > Thank you TreKing for your advice, > > But then in my handleMessage I would have to check with > > if (inst instance of Foo) > inst.foocallback(); > else if (inst instanceof Bar) > inst.barcallback(); > else if (...) > > or is there a neater solution, perhaps using polymorphism or a design > pattern of some sort > so that my handleMessage does not quickly turn into a mess? > > Thanks, > > John Goche > > > > On Tue, Nov 29, 2011 at 11:02 PM, TreKing <[email protected]> wrote: > >> On Tue, Nov 29, 2011 at 3:46 PM, John Goche >> <[email protected]>wrote: >> >>> The number of sprites is indefinite (could vary in number) but each >>> needs to manage itself individually. On top of this the world has its >>> own handler to manage updates to itself. >>> >> >> You don't need separate handlers, you can pass the instance of the object >> that is being updated in the handler message, then use one single handler >> for the main thread. >> >> >> ------------------------------------------------------------------------------------------------- >> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago >> transit tracking app for Android-powered devices >> >> -- >> 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 > > > -- 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

