https://kotlinlang.org logo
#compose
Title
# compose
l

loloof64

01/07/2022, 4:10 PM
Hi everybody ! Given this
LazyColumn
, how can I know if an item has been Long-clicked, and its index ?
I found this link, but I'm not sure if it can apply to a long click: https://stackoverflow.com/a/66376654/662618
Because there's
Copy code
InteractionState#collectIsPressedAsState()
but nothing for a long press.
l

loloof64

01/07/2022, 4:24 PM
Thank you, but how to use this modifier
combineClickable
and
onLongClick
in order to get the selected item ? Because
onLongClick
can't give me that information directly
z

Zoltan Demant

01/07/2022, 5:16 PM
You can specify it as a modifier on each item, e.g. in
FolderItem/FileItem
where you have access to the long clicked item as well.
👍🏾 1
l

loloof64

01/07/2022, 11:15 PM
Thank you very much 😃 I'll try it.
🙏🏽 1
It worked : thank you very much 🙂
🙌🏽 1
2 Views