Search code examples
androidkotlinviewandroid-jetpack-compose

share image of compose component


i want to share image of my component , but cannot accses view of it, to share. how i can accses view of my component or share image of it. my component is a card

@Composable
fun CardItem(modifier: Modifier=Modifier,card: Card, onClick:()->Unit) {
Box(
   modifier
        .background(
            if (card.card_number == AllCardsActivity.NOCARD) MaterialTheme.colorScheme.secondary
            else MaterialTheme.colorScheme.primary,
            RoundedCornerShape(20.dp)
        )
        .width(CardWidth)
) {
    Column(Modifier.padding(25.dp)) {....

Solution

  • i want to share image of my component

    If you mean that you want to capture a Bitmap of a composable for the purposes of sharing it, there are at least three libraries for this:

    And all three are open source, so if you do not like them for some reason, you can examine their implementations, contribute back changes, etc.