-
-
Save KatieBarnett/d69c5e98003f7a54c28bc9f8913ff3d0 to your computer and use it in GitHub Desktop.
Wear OS Input capture result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val launcher = rememberLauncherForActivityResult( | |
ActivityResultContracts.StartActivityForResult() | |
) { | |
it.data?.let { data -> | |
// Get all the results | |
val results: Bundle = RemoteInput.getResultsFromIntent(data) | |
// Use the inputTextKey to select the input we are interested in | |
val newInputText: CharSequence? = results.getCharSequence(inputTextKey) | |
// Save the text to our variable as a string. Ensure to handle the null case | |
userInput = newInputText?.toString() ?: "" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment