Skip to content

Instantly share code, notes, and snippets.

View saugatrai33's full-sized avatar
:octocat:

Saugat Rai saugatrai33

:octocat:
View GitHub Profile
@saugatrai33
saugatrai33 / Gender.java
Created February 28, 2021 14:14
Java 8 Streams API
package com.company;
public enum Gender {
MALE, FEMALE
}
@saugatrai33
saugatrai33 / MainActivity.kt
Created February 21, 2021 11:45
Using MLKit to recognise text in Android.
private fun recognizeImage() {
val jokeImg = BitmapFactory.decodeResource(resources, R.drawable.joke_shampoo)
val inputJokeImg = InputImage.fromBitmap(jokeImg, 0)
val textRecognizer = TextRecognition.getClient()
textRecognizer.process(inputJokeImg)
.addOnSuccessListener { texts ->
run {
Log.d("MainActivity", "recognizeImage: ${texts.text}")
recognizedTextShow.text = texts.text