How can I get the selected text from the `SelectionContainer`?
t
How can I get the selected text from the
SelectionContainer
?
👆 2
jetpack compose 3
r
I don't know if there is a Compose specific way but if you get access to the
ClipboardManager
as outlined in this thread (https://kotlinlang.slack.com/archives/CJLTWPH7S/p1624297234089700) you should then be able to use
getText()
.
a
i was looking for same thing and find out that textfieldvalue have function like :
Copy code
textFieldValueState.getSelectedText()
textFieldValueState.getTextAfterSelection(Int.MAX_VALUE)
textFieldValueState.getTextBeforeSelection(Int.MAX_VALUE)
so that might help to someone who also need the same thing . as i search here for something after failed on stackoverflow . there is only java and some kotlin solution ..
125 Views