'YouTubeBaseActivity in Jetpack Compose
I want to use YouTube player from YouTubeDataAPI v3 in Jetpack Compose. But it should be extended of YouTubeBaseActivity. The main problem is that activity extended of YouTubeBaseActivity haven't composable setContent { }. Only setContentView(). Should i create another activity, extended of YouTubeBaseActivity and xml layout? Or there is another way to use it?
Solution 1:[1]
You can create compose view manually. Documentation here shows how to do it with a fragment, but you can do the same with an activity - subclass it from YouTubeBaseActivity, add this to your XML view:
<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Then you can set compose content to this view.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pylyp Dukhov |
