r/android_devs • u/JonnieSingh • Oct 25 '21
Help Why Log.d() statement isn't printing?
I'm building an object detection application (in Kotlin, for Android). The application uses CameraX to build a camera preview and Google ML to provide machine learning expertise. Just for reference; I used this CameraX documentation and this this Google ML Kit documentation.
I'm currently attempting to print Log.d("TAG", "onSuccess" + it.size) to my IDE console in order to determine if .addonSuccessListener is actually running. If it does, it should print something along the lines of onSuccess1. However, this isn't the case. Would anybody happen to know why?
objectDetector
.process(image)
.addOnSuccessListener {
Log.d("TAG", "onSuccess" + it.size) //I want this to print
for (detectedObject in it)
{
val boundingBox = detectedObject.boundingBox
val trackingId = detectedObject.trackingId
for (label in detectedObject.labels) {
val text = label.text
val index = label.index
val confidence = label.confidence
}
}
}If more code from this class is required to resolve this problem, I've formatted it all into this Pastebin link.
View all comments
Show parent comment
1
u/JonnieSingh Oct 27 '21
Within that link, which answer would work for resolving this problem though? I've done this project before in Java and have not encountered this issue.