Recently I have prepared to write a demo and use the MVC Framework for implementation. By the way, let's test the results of the learning design model in February.
Http://www.moandroid.com /? P = 439
MVC is currently a popular framework. by Google, we can find that almost all application development uses the MVC framework, such as. net, Java spring, Java struts, and PHP. So what is MVC and why it is widely used?
Briefly describe what MVC is. MVC (Model-View-Controller): m Refers to the logical model, V refers to the view model, and C refers to the Controller. A logical model can be used for multiple view models. For example, you can use a column chart or pie chart to represent a batch of statistical data. A view model can also be used for multiple logic models. The purpose of using MVC is to separate the implementation code of M and V, so that the same program can use different forms of representation, while the purpose of C is to ensure the synchronization of M and V, once M changes, V should be updated synchronously, which is exactly the same as the Observer Pattern in design patterns. For detailed analysis, refer to what MVC is introduced in Baidu?
Http://zh.wikipedia.org/wiki/MVC (MVC in Wikipedia)
What are the advantages of using MVC? From the user's point of view, you can select your desired data browsing method based on your needs. For example, for an online document, you can choose to read it on an HTML webpage or PDF webpage. From the developer's point of view, MVC completely separates the logic layer of the application from the interface. The biggest benefit is that the interface designer can directly participate in interface development, programmers can focus on the logic layer. Instead of handing over all the materials to the developer as before, the developer can implement the interface. In vs 2008 development tools, designers can directly use Silverlight to Develop interfaces. Android is developed using the replices tool in a simpler way. designers design interfaces in droiddraw, save it as XML. Open it in es to view the designer's interface.
The interface section of Android also uses the popular MVC Framework. In Android, M is the binary data in the application, and V is the user interface. The android interface is directly saved using XML files, making it easy to develop and change the interface. In Android, C is also very simple. An activity can have multiple interfaces. You only need to pass the view ID to setcontentview () to specify the view model to display data.
Data Binding in the android SDK also uses methods similar to the MVC Framework to display data. Data can be directly displayed on the view model by encapsulating the data in the control layer according to the view model requirements (that is, the adapter in the android SDK), thus realizing data binding. For example, to display the listactivity of all data in the cursor, the view layer is a listview, which encapsulates the data as listadapter and passes it to the listview. The data is actually in the listview.
Currently, the MVC framework used in Android is relatively simple and will be improved in the future. If the android SDK is similar to the visual/document model in MFC, it may take some time. Let's wait.