Reprint please indicate the source, thank you!
Last month Google Android Architecture Components 1.0 Stable release, pumping work Gap wrote a demo, for reference only
GitHub Address: Https://github.com/AllenWen/android-iWeather
1. Highlights
One is life cycle management---lifecycles, the reference of various types of components and periodic binding, so as to effectively avoid memory leaks;
The second is the Livedata, the protagonist in the data stream, acting similar to the RX's observer;
Third, the introduction of a new Database ORM framework---The bedroom, of course, life cycle security, modification immediately effective;
Four is a library called paging, used for paging processing, this project is useless.
2. Overview
Look at the figure, of course, is an MVVM framework, acitivity/fragment is view, ViewModel acts as a VM, a warehouse consisting of a local database and network data (Repository) is the model,
Acitivity/fragment can implement Lifecycleowner interface, register lifecycleobserver for life cycle management,
Livedata acts as data in a one-way data stream and binds to the life cycle
3. Project
With a free weather API that knows the weather and writes a minimalist-style weather app, it doesn't map, see GitHub for details
Android Architecture components--Project Combat