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

Android Kotlin Fundamentals codelab: Android Kotlin Fundamentals 05.1: ViewModel and ViewModelFactory #29

Closed
Adventures-in-Kotlin opened this issue Feb 8, 2020 · 1 comment

Comments

@Adventures-in-Kotlin
Copy link

Describe the problem
The code used to initialise the ViewModel is depreciated.
viewModel = ViewModelProviders.of(this).get(GameViewModel::class.java)

In which lesson and step of the codelab can this issue be found?
Android Kotlin Fundamentals 05.1: ViewModel and ViewModelFactory

This code seems to work
viewModel = ViewModelProvider(this).get(GameViewModel::class.java)

Refer to StackOverflow:
https://stackoverflow.com/questions/53903762/viewmodelproviders-is-deprecated-in-1-1-0

How to reproduce?
ViewModelProviders

Enter the code into Android Studio

Versions

  1. What version of Android Studio are you using? 3.5.3
  2. What API level are you targeting?
    Min: 19
    Max: 28

Additional information
Add any other context about the problem here.

codelab: android-kotlin-fundamentals

@kkuan2011
Copy link

Duplicate of #33

@kkuan2011 kkuan2011 marked this as a duplicate of #33 Aug 11, 2020
k12e5989 pushed a commit to k12e5989/android-kotlin-fundamentals-apps that referenced this issue Dec 2, 2020
…-training/GDGFinderServer

Update server URL
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