Skip to content

Instantly share code, notes, and snippets.

@DanishAmjad12
Created October 10, 2021 13:46
Show Gist options
  • Save DanishAmjad12/b526028b390b05c4ba2f3d9b442f1e00 to your computer and use it in GitHub Desktop.
Save DanishAmjad12/b526028b390b05c4ba2f3d9b442f1e00 to your computer and use it in GitHub Desktop.
fun recognize(context: Context) {
val ink = inkBuilder.build()
recognizer.recognize(ink)
.addOnSuccessListener { result: RecognitionResult ->
Toast.makeText(context, "This is ${result.candidates[0].text}", Toast.LENGTH_LONG)
.show()
}
.addOnFailureListener { e: Exception ->
Toast.makeText(context, "Error", Toast.LENGTH_LONG)
.show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment