Quantcast
Channel: How to perform a haptic feedback in Jetpack Compose - Stack Overflow
Viewing all articles
Browse latest Browse all 6

How to perform a haptic feedback in Jetpack Compose

$
0
0

Using jetpack compose, for a clickevent how to perform haptic feedback. I am new to jetpack compose.This is what i tried -

val hapticFeedback = LocalHapticFeedback@Composablefun Tab() {    Row() {        Icon(imageVector = icon, contentDescription = text)        if (selected) {            // i tried both the following ways, none are working.             hapticFeedback.current.performHapticFeedback(                HapticFeedbackType(10)            )            hapticFeedback.current.performHapticFeedback(HapticFeedbackType.TextHandleMove)....            Spacer(Modifier.width(12.dp))            Text(text.uppercase(Locale.getDefault()))        }    }}

I am able to see the text when it is getting selected, but not getting a subtle vibrating feedback.


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles



Latest Images