解决方法
Model-View-Control works fine
The actual
Activity
class doesn’t extend android’sView
class,but it
does,however,handle displaying a window to the user and also handle
the events of that window (onCreate
,onPause
etc).This means,that when you are using a MVC pattern,your controller
will actually be a pseudo View-Controller. Since it is handling
displaying a window to the user,with the additional view components
you have added to it withsetContentView
,and also handling events for
atleast the varIoUs activity life cycle events.In MVC,the controller is supposed to be the main entry point. Which
is a bit debatable if this is the case when applying it to android
development,since theactivity
is the natural entry point of most
applications.
那么,Android中的伪MVC:
Model =具有主要业务逻辑的实体或类
View =布局,资源和小部件,如EditText
Controller = Activity,Adapter