Series of articles look here
Android Jetpack Architecture Components — What is Jetpack?
Android Jetpack architecture component — Lifecycle usage
Android Jetpack Architecture component — Lifecycle Principles
Android Jetpack Architecture Components – This article takes you through the ViewModel and how it works
Android Jetpack architecture component – LiveData Usage
Android Jetpack Architecture component – LiveData Principles
preface
When it comes to Android architecture, the first things that come to mind are MVC, MVP, and MVVM. They are focused on views and models. With the development of Android, from the original framework is very little, it is all do-it-yourself. Now there are more and more frameworks and more types of models, leading to more and more non-standard development. We know that MVP and MVVM only apply to architecture, not to framework selection. In 2018, Google launched Jetpack to address these issues.
What is Jetpack?
Jetpack is not a new architecture, but a suite of libraries that help developers follow best practices, reduce boilerplate code and write code that runs consistently across Android versions and devices, allowing developers to focus on writing important code.
The advantage of the Jetpack
If you need to use Jetpack, your boss won’t agree to change without some advantages. Here’s a look at jetpack’s advantages:
- Jetpack has life-cycle awareness capabilities to reduce NPE crashes and memory leaks. For us to develop a robust and smooth program to provide a strong guarantee.
- Jetpack can help make Android development more efficient by reducing boilerplate code.
The classification of the JetPack
Take a look at this image from Google:
According to the figure, Jetpack is divided into four categories:
- Base – Foundation
- Architecture – Architecture
- Interface – the UI
- Behaviors – behaviors
Foundation (Foundation Component)
- AppCompat: Helps with compatibility with older versions of Android
- Android KTX: Optimized Jetpack and Android PLATFORM apis for Kotlin to help developers use Kotlin for Android development in a simpler, more enjoyable, and more customizable way
- Multidex: supports applications with multiple Dex files
- Test: quickly detect Kotlin or java-based code from AndroidStudio
Architecture (Architecture component)
- Data Binding: Belongs to a supporting library that declaratively binds interface components in a layout to Data sources in an application
- Lifecycles: Manage the Activity and Fragment Lifecycles
- LiveData: is an observable data holder class. Unlike regular Observables, LiveData is lifecycle aware
- Navigation: Handles everything needed for in-app Navigation
- Paging: Loads once/loads on demand && displays small pieces of data
- Room: Helps developers access SQLite databases more smoothly and in a friendly way
- ViewModel: Stores and manages UI-related data in a life-cycle-aware manner
- WorkManager: A job that manages the Android background and can run deferred asynchronous tasks even after the application exits or the device is restarted
UI (Interface component)
- Animation and Transition: This framework contains built-in animations for common effects and allows developers to create custom animations and lifecycle callbacks
- Auto: The component that develops the Android Auto application that provides a standardized interface and user interaction for all vehicles
- TV: Build apps that allow users to experience immersive content on the big screen
- Wear: Develop components for Wear applications
- Emoji: Users can get the latest Emoji even if they haven’t updated Android
- Fragment: Basic unit of a componentized interface
- Layout: Declare UI elements in XML or instantiate UI elements in code
- Paletee: Extracting useful information from the color palette
Behavior (Behavior Component)
-
DownloadManager: Handles long-running HTTP downloads && timeout reconnections
-
Media & Playback: Backward-compatible API for Media playback and routing
-
Permissions: Compatibility API for checking and requesting application Permissions
-
Notifications: Provides backward compatible notification apis with support for Wear and Auto
-
Sharing: Provides Sharing operations suitable for the application action bar
-
Slices: Create flexible interface elements that display application data outside the application
This article first appeared on my personal blog: Android Jetpack Architectural Components – What is Jetpack?
For more articles, please pay attention to my official number:Code the farmers work