Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

08_StoreFavoriteFoodsInRoomDatabase #1

Open
Keesdil opened this issue Jun 1, 2019 · 0 comments
Open

08_StoreFavoriteFoodsInRoomDatabase #1

Keesdil opened this issue Jun 1, 2019 · 0 comments

Comments

@Keesdil
Copy link

Keesdil commented Jun 1, 2019

Hello Peter,

Following your development for nutrilicious app i did not manage to get the recyclerview loaded with "favorites".
I guess something goes wrong with observeFavorites() in Favoritesfragment.
For the line :
favorites.observe(this@FavoritesFragment, Observer { foods ->
foods?.let {
launch(UI) {
(rvFavorites.adapter as? SearchListAdapter)?.setItems(foods)
}
}

the app crashes with :
"java.lang.IllegalStateException: Cannot invoke observe on a background thread"

Also use of "launch" as in your examples is deprecated, changes i made to overcome did not lead to this crash but did not load the recyclerview either.

Hope this helps to help me further..
Regards,
Kees Dil,
keesdil@hotmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant