{Apologies for the junction with the Android Developer Forum. There were no answers}
I have an interesting design task:
I have an interface (Activity) and a backend (written in my native C / C ++) code. Backend - it is a complex object, which partly controls the flow of the application and once it launches its own thread. So I have a "distributed control" scenario.
The operation should be able to send messages asynchronously. backend, which then takes certain actions. But backend also need to send an asynchronous message to the activity to which he responds by using the UI, shooting techniques, etc.
In fact, I need a double-sided listener.
Thus, the backend sends a message on the screen (remove the image, help the user to get a location, make another image, etc.), and the screen does what he needs to do. But, in addition, the screen must also be able to call the backend-listener to send messages (captured camera image, the system generated - the message "I got paused / destroy", etc.) in the event callbacks. The main problem is that all this asynchronously.
Is this possible without the hard link? Is it possible?
I thought about Asynctask / handlers (but it's a one-way street for informing on the UI thread), the observer pattern (both objects are the observer / observed?), But it confused with, where to start. There are suggestions, links would be very useful.
source share