How can you add clickability to an image displayed by the composable function shown below, allowing it to trigger a specific action when clicked ?


@Composable
fun ClickableImage(imageUrl: String, onClick: () -> Unit) {
Image(
painter = rememberImagePainter(imageUrl),
contentDescription = "Clickable Image",
modifier = Modifier.clickable { onClick() }
)
}

Choose the correct option that demonstrates the right implementation of the ClickableImage composable function to achieve the desired behavior.

ClickableImage("https://example.com/image.png", onImageClick)

ClickableImage(onClick = { onImageClick }, imageUrl = "https://example.com/image.png")

ClickableImage(imageUrl = "https://example.com/image.png") { onImageClick() }

 ClickableImage(onClick = onImageClick, imageUrl = "https://example.com/image.png")

Verified Answer
Correct Option - a

To get all Infosys Certified Android Specialist Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in