Use a ViewModel |

This is a companion discussion topic for the original entry at

Doing this at the end of August, it inserts


into my grade but in version 2.2 ViewModelProviders is deprecated. So I downgraded it to version 2.1 and it seems to work so far. From the documentation it appears in 2.2 one can just do


But I was never able to get the “get” to import so I just downgraded rather than mess with it.

Sorry to be a pest – I’m also a bit confused by

    activity?.let {
        listDataManager = ViewModelProviders.of(this).get(

    val lists = listDataManager.readLists()

I am new to Kotlin but I am not clear why the listDataManager instantiation is inside a let block. But given that it is, shouldn’t the readLists method be inside as well, as if there is no activity then the listDataManager won’t be created and invoking readlLists on it would cause a crash. I also realize if there is not activity you have bigger problems :slight_smile:

@bdmoakley Can you please help with this when you get a chance? Thank you - much appreciated! :]

Is there any plan to update the android video courses? I like these contents ,but some is too old (2020) to easily follow

Yes, we are in the process of updating all of our Android tutorials. This course is slated to be updated later this year. To follow along, you can always download the version of Android Studio that was used to produce this version of the course (Android Studio 3.5).