android / codelab-android-paging

Jetpack Paging codelab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

codelab step 19 correction

amazingvoice opened this issue · comments

When updating the Injection file, the code segment shown in the codelab is written as:

object Injection {
    private fun provideGithubRepository(context: Context): GithubRepository {
        return GithubRepository(GithubService.create(), RepoDatabase.getInstance(context))
    }

    fun provideViewModelFactory(context: Context): ViewModelProvider.Factory {
        return ViewModelFactory(provideGithubRepository(context))
    }
}

However the constructor of ViewModelFactory needs 2 parameters. The parameter SavedStateRegistryOwner is missing.

This has been fixed in the current iteration of the codelab.