I have an interesting design challenge:

I have a frontend(Activity) and a backend (written in native C/C++)
code. The backend is a complex object which partially controls the
flow of application & once started runs in it's own thread. So I have
a "distributed control" scenario.

The Activity needs to be able to send messages asynchronously to the
backend which then takes certain actions. But the backend also needs
to be able to send messages asynchronously to the Activity, to which
it responds by chnaging UI, firing methods etc.

Essentially what I need is a two-way listener.

So backend sends a message to screen (take picture, prompt user, get
location, take another picture nowm etc) and screen does what it needs
to do. But in addition, the screen should also be able to call the
backend-listener to send back messages (captured camera image, system
generated - "I got paused/destroyed" message, etc) in the callbacks of
these events. Main problem is that this is all asynchronous.

Is this possible without tight-coupling? Is this even possible?

I have thought of Asynctask/handlers (but that's a one way street for
informing the UI thread), observer-pattern (both objects will be
observer/observable?) but confused on where to begin. Any thoughts,
links would be very helpful.

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