How can I separate Logic/UI in Android
- by Ungureanu Liviu
Hi,
I want as my application to be structured in 2 parts: the logic code and the UI.
I've tried to implement that using a controller class(here I keep the logic code) inside of each activity.
The activity send messages to controller and receive the answer in two ways:
the answer is returned immediately (if the action is not complex and it can be done in a verry short time)
the activity set some listeners and the controller fire this listener when the action is complete.
The problems appears when the controller have a lot of objects(each object should handle a set of actions and for each action I have to set & trigger a listener): it is hard to keep the code syncronized.
I'm asking if you know a better way to implement this mechanism.
Thank you.