-1

I want to make an AutoCompleteTextview with RapidApi Urban Dictionary where I would filter words by input. But I am a beginner. I've searched a lot tutorials on it. But I did not find any such that. I just get this from RapidApi

val client = OkHttpClient()

val request = Request.Builder()
    .url("https://mashape-community-urban-dictionary.p.rapidapi.com/define?term=wat")
    .get()
    .addHeader("x-rapidapi-key", "8345a8b4d6ms...")
    .addHeader("x-rapidapi-host", "mashape-community-urban-dictionary.p.rapidapi.com")
    .build()

val response = client.newCall(request).execute()

and in AutoCompleteTextview tutorial I see that we need an array but with above code I don't know how can I get an array from the response. I want a full answer on it.

halfer
  • 19,824
  • 17
  • 99
  • 186
mr. groot
  • 334
  • 4
  • 18
  • Can you add to this question a formatted version of what is in the `response` object after this call? Please also describe in the question what is wrong with it. – halfer Feb 21 '21 at 18:50
  • I want to know how can i get the list of words from the response. – mr. groot Feb 22 '21 at 09:35

1 Answers1

1

You need

  • a library like Retrofit for sending requests to any API.
  • another library like Moshi or Gson as JSON parser to convert responses into data objects.
  • Using these response data objects, populate arrayAdapter to use it with AutoCompleteTextView
Varsha Kulkarni
  • 1,389
  • 2
  • 13
  • 17
  • Umm.. well i already know these things, i want a complete solution, please take some time and give me a complete solution. – mr. groot Feb 20 '21 at 18:33
  • 1
    Then please start implementing it yourself! If you get stuck somewhere, you will get help here for sure. – Varsha Kulkarni Feb 20 '21 at 20:07
  • @mr.groot: I would say Varsha is completely correct. Stack Overflow is intended to render help, i.e. a shared amount of assistance. There is broadly still an expectation that the question author is willing to help themselves. – halfer Feb 21 '21 at 18:48
  • Yes @halfer you are right, after versha's suggestion I realised and started doing it by myself. if i stuck anywhere I'll ask in the comment until i get a major problem. – mr. groot Feb 22 '21 at 09:38