I'm trying to use TOMTOM search API in my kotlin application
Here is my code :
private fun testSearch() {
val observer = object : DisposableSingleObserver<FuzzySearchResponse>() {
val text = "cairo"
val search = FuzzySearchQueryBuilder.create(text).build()
override fun onSuccess(fuzzySearchResponse: FuzzySearchResponse) {
search.success(fuzzySearchResponse.results)
}
override fun onError(throwable: Throwable) {
search.error(null, Error(throwable.message))
}
}
}
added API to AndroidManfist.xml
and initialized tomtom search in my Gradle
file
as shown in the image, the IDLE can't find both reference error or success.
Your IDE can't find a reference because you are looking for it inside a
FuzzySearchQuery
object instead of theSearchApi
object which is not defined in your code at all. Please find a solution in below (slightly modified) function: