How to separate logic / UI in Android

I want my application to be divided into two parts: logic code and UI

I try to implement it in each activity using the controller class (here I keep the logical code). The activity sends a message to the controller and receives the answer in two ways:

>The answer is returned immediately (if the action is not complex, it can be completed in a short time) > the activity sets up some listeners, which are triggered by the controller when the operation is completed

Problems arise when the controller has many objects (each object should handle a set of operations, and I have to set up each operation and trigger a listener): it's difficult to keep the code synchronized

I ask if you know a better way to implement this mechanism

thank you.

resolvent:

Personally, I think activity is a controller. Widgets are views. Others may disagree. I am far away from MVC purists

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>