Android-youtube-player: How to add LifeCycle Observer to youtubePlayer if it is in adapter of recycler view?

Created on 2 Nov 2019  路  2Comments  路  Source: PierfrancescoSoffritti/android-youtube-player

I have defined com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView inside adapter layout of my recyclerview and I am not able to figure out how to add lifecycleobserver to the view. I am passing context in the adapter of my recyclerview but I can't access lifecycleobserver

question

All 2 comments

Add an extra contstructor argument and pass a lifecycleoberver in there, or add a public method and pass a lifecycleobserver using it after constructing.

You can get the lifecycle from an Activity or Fragment.

Was this page helpful?
0 / 5 - 0 ratings