If the callbacks share a common interface, you could accomplish that with an interface object.

On 11/30/2011 8:32 PM, John Goche 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 <treking...@gmail.com <mailto:treking...@gmail.com>> wrote:

    On Tue, Nov 29, 2011 at 3:46 PM, John Goche
    <johngoch...@googlemail.com <mailto:johngoch...@googlemail.com>>
    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
    android-developers@googlegroups.com
    <mailto:android-developers@googlegroups.com>
    To unsubscribe from this group, send email to
    android-developers+unsubscr...@googlegroups.com
    <mailto: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

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