Best Practices for Android development

Source: Internet
Author: User

These experiences have not been systematically combed, and the idea of where to write is:

1.The MVC pattern developed by Android, or the MVVM pattern

Client development, the main work is the interface and logic, if the interface-related code and logic-related code coupling too much, it is not easy to refactor, in the United States this one months, we have basically formed a set of effective development paradigm,

That is, if the interface element does not need a life cycle, it is all custom view to implement, if need life cycle, then use fragment to implement.

1.Activity is the interface of the container, responsible for the creation of the interface, refresh, do not do too much logic in the activity. For jump handling between activity please put it in the activity

2. For the main data of the interface, encapsulated into the corresponding bean Model, facilitate the transfer of parameters between the activity, or the interaction with the network

3. The interface and data are completed by loader asynchronous loading.

2.Internet access for Android

Before the United States regiment with loader plus synchronous network access to complete, and now mainly with Retrofit,rxjava and loader to match, the local cache of data simulated HTTP cache mechanism

3.Gradle

The company uses a business split-up approach for simultaneous development, each of which is independent into a business library project, and for the framework and public base classes are independent of the base library and the common library, doing so

The benefit is that the dependencies between the various business groups can be less collaborative, and the downside is that there is some resource redundancy and code redundancy (which is acceptable in terms of development efficiency improvements).

Gradle can meet this mode of work, because Gradle and Maven are similar, and the libraries they depend on have different versions, so that teams can decide for themselves what they want. Ant-based compilation mode is not very good.

Meet.

Best Practices for Android development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.