Skip to content

Commit 4828307

Browse files
committed
Update comments related to the Fragment lifecycle method onViewCreated()
1 parent 00ecd48 commit 4828307

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/example/android/devbyteviewer/ui/DevByteFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ class DevByteFragment : Fragment() {
4444

4545
/**
4646
* One way to delay creation of the viewModel until an appropriate lifecycle method is to use
47-
* lazy. This requires that viewModel not be referenced before onActivityCreated, which we
47+
* lazy. This requires that viewModel not be referenced before onViewCreated(), which we
4848
* do in this Fragment.
4949
*/
5050
private val viewModel: DevByteViewModel by lazy {
5151
val activity = requireNotNull(this.activity) {
52-
"You can only access the viewModel after onActivityCreated()"
52+
"You can only access the viewModel after onViewCreated()"
5353
}
5454
//The ViewModelProviders (plural) is deprecated.
5555
//ViewModelProviders.of(this, DevByteViewModel.Factory(activity.application)).get(DevByteViewModel::class.java)

0 commit comments

Comments
 (0)