views:

33

answers:

1

For example, say the main Activity has an custom object foo with a method called bar. When foo.bar() is called via the activity, it does a bunch of things on a thread and when it is finished it would somehow alert the main ui thread, the activity, it's parent that it is finished.

I imagine this working the same way an event like a OnClickListener works. The bar() method would trigger an event saying "Hey I'm finished" and that would trigger the listener on the main activity.

Hope that makes sense.

Thanks for your help!

+1  A: 

You basically need the observer pattern. You can read Design Patterns Uncovered: The Observer Pattern

Damien
That's exactly what I was looking for. Thank you.
littleFluffyKitty