Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Android Kotlin Fundamentals codelab: #222

Closed
davidwekesar opened this issue Jun 24, 2020 · 1 comment
Closed

Android Kotlin Fundamentals codelab: #222

davidwekesar opened this issue Jun 24, 2020 · 1 comment

Comments

@davidwekesar
Copy link

codelab: android-kotlin-fundamentals

Initializing a ViewModel object using ViewModelProviders.of() method.

In the codelab the GameFragment ViewModel is initalized like this:

viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)

The ViewModelProviders.of() method seems to be deprecated and now a ViewModel is initialized a followed:

viewModel = ViewModelProvider(this).get(GameViewModel::class.java)

The issue is found in:
Android Kotlin Fundamentals 05.1: ViewModel and ViewModelFactory, Lesson 5, Step 3.

Versions:

  1. Android Studio 4.0
  2. Target SDK version: 29
@kkuan2011
Copy link

Duplicate of #33

@kkuan2011 kkuan2011 marked this as a duplicate of #33 Aug 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants