Skip to content

Commit 27b171c

Browse files
Further improvements.
1 parent 60fbace commit 27b171c

File tree

1 file changed

+7
-7
lines changed
  • content/learning-paths/smartphones-and-mobile/build-android-selfie-app-using-mediapipe-multimodality

1 file changed

+7
-7
lines changed

content/learning-paths/smartphones-and-mobile/build-android-selfie-app-using-mediapipe-multimodality/5-view-model-setup.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ layout: learningpathall
88

99
## ViewModel
1010

11-
The `ViewModel` class is a [business logic or screen level state holder](https://developer.android.com/topic/architecture/ui-layer/stateholders). It exposes state to the UI and encapsulates related business logic.
11+
The `ViewModel` class is a business logic or screen level state holder, as explained in [ViewModel overview](https://developer.android.com/topic/architecture/ui-layer/stateholders) on the Android Developer website. It exposes state to the UI and encapsulates related business logic.
1212

13-
The main advantage of using `ViewModel` is that it caches state and persists it through configuration changes. This means that the UI does not have to fetch data again when navigating between activities, or following configuration changes, such as screen rotation.
13+
The main advantage of using the `ViewModel` class is that it caches state and persists it through configuration changes. This means that the UI does not have to fetch data again when navigating between activities, or following configuration changes, such as screen rotation.
1414

15-
## Introduce Jetpack Lifecycle dependency
15+
## Add Android Jetpack Lifecycle libraries
1616

17-
You can now bring in the Jetpack Lifecycle libraries.
17+
You can now add Jetpack Lifecycle libraries to your app.
1818

19-
1. Navigate to `libs.versions.toml` and append the following line to the end of `[versions]` section. This defines the version of the Jetpack Lifecycle libraries that you will be using.
19+
1. Navigate to `libs.versions.toml` and append the following line to the end of the `[versions]` section. This defines the version of the Jetpack Lifecycle libraries that you will be using.
2020

2121
```toml
2222
lifecycle = "2.8.7"
2323
```
2424

25-
2. Insert the following line to `[libraries]` section, ideally between `androidx-appcompat` and `material`. This declares the Jetpack Lifecycle ViewModel Kotlin extension:
25+
2. Insert the following line to the `[libraries]` section, ideally between `androidx-appcompat` and `material`. This declares the Jetpack Lifecycle ViewModel Kotlin extension:
2626

2727
```toml
2828
androidx-lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
@@ -102,7 +102,7 @@ You might notice that success and failure messages are logged with different API
102102
{{% /notice %}}
103103

104104
2. Bind `MainViewModel` to `MainActivity` by inserting the following line into `MainActivity.kt`, above the `onCreate` method.
105-
Don't forget to import the `viewModels` [extension function](https://kotlinlang.org/docs/extensions.html#extension-functions) through `import androidx.activity.viewModels`.
105+
Do not forget to import the `viewModels` [extension function](https://kotlinlang.org/docs/extensions.html#extension-functions) through `import androidx.activity.viewModels`.
106106

107107
```kotlin
108108
private val viewModel: MainViewModel by viewModels()

0 commit comments

Comments
 (0)