'Is there a way to pass a variable to a AbstractComposeView
I have a custom view in jetpack compose but I want to pass additional data. I tried to create additional variable but it has a lint error.
Custom view
BlendedPhotoViewis missing constructor used by tools:(Context)or(Context,AttributeSet)or(Context,AttributeSet,int)
Here is my class
class BlendedPhotoView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
val photoUri: String?
) : AbstractComposeView(context, attrs, defStyleAttr) {
@Composable
override fun Content() {
BuildBlendedPhoto(photoUri = photoUri)
}
fun capture(view: BlendedPhotoView) {
val bitmap = ImageUtils.generateShareImage(view)
ShareUtils.shareImageToOthers(context, "test", bitmap)
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
