How can I separate Logic/UI in Android

Posted by Ungureanu Liviu on Stack Overflow See other posts from Stack Overflow or by Ungureanu Liviu
Published on 2011-01-09T21:07:54Z Indexed on 2011/01/09 23:53 UTC
Read the original article Hit count: 244

Filed under:

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:

  1. the answer is returned immediately (if the action is not complex and it can be done in a verry short time)
  2. 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.

© Stack Overflow or respective owner

Related posts about android