安卓构架组件——概述 Android Architecture Components
谷歌官文文档地址:https://developer.android.google.cn/topic/libraries/architecture
安卓构架组建是库的集合:帮助你设计健壮的、易测试的、可维护的应用。使用类作为入口管理UI组建的生命周期和处理数据持久化。
Android architecture components are a collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.
- 了解将健壮的应用放在一起的基础知识请看应用构架指南。Learn the basics of putting together a robust app with theGuide to app architecture.
- 管理应用的生命周期。新的生命周期感知组建技术帮助管理Activity和fragment的生命周期。保持设置的改变、避免内存泄漏并且更容易的将数据载入UI。Manage your app's lifecycle. New lifecycle-aware componentshelp you manage your activity and fragment lifecycles. Survive configuration changes, avoid memory leaks and easily load data into your UI.
- 使用LiveData创建数据对象,这样底层数据更改时会通知用户界面。 Use LiveData to build data objects that notify views when the underlying database changes.
- ViewModel用于保存和用户界面香港的数据,这样界面旋转时相关的数据不会被丢失。 ViewModel stores UI-related data that isn't destroyed on app rotations.
- Room是一个SQLite对象映射库。使用它来避免样板代码,并轻松地将SQLite表数据转换为Java对象。 Room提供了SQLite语句的编译时检查,并且可以返回RxJava,Flowable和LiveData可观察对象。 Room is a SQLite object mapping library. Use it to avoid boilerplate code and easily convert SQLite table data to Java objects. Room provides compile time checks of SQLite statements and can return RxJava, Flowable and LiveData observables.