title: How can I use Response.Listener volley in android app with Koltllin
body: <p>I'm developing an android app with Kotlin, api 28. I also use swagger to get all the webservices. After getting the "Kotlin_client_generated" file with swagger, and add it in my project. I want to use one of the mobileApi as the following :</p>
  
  <pre><code>fun apiMobileAPIGetProviderPost(disc: kotlin.Any, pageIndex: kotlin.Int, pageSize: kotlin.Int, sort: kotlin.String, order: kotlin.String) : kotlin.Array&lt;ProviderData&gt; {
          val localVariableBody: kotlin.Any? = disc
          val localVariableQuery: MultiValueMap = mapOf("pageIndex" to listOf("$pageIndex"), "pageSize" to listOf("$pageSize"), "sort" to listOf("$sort"), "order" to listOf("$order"))
  
          val contentHeaders: kotlin.collections.Map&lt;kotlin.String,kotlin.String&gt; = mapOf()
          val acceptsHeaders: kotlin.collections.Map&lt;kotlin.String,kotlin.String&gt; = mapOf("Accept" to "application/json")
          val localVariableHeaders: kotlin.collections.MutableMap&lt;kotlin.String,kotlin.String&gt; = mutableMapOf()
          localVariableHeaders.putAll(contentHeaders)
          localVariableHeaders.putAll(acceptsHeaders)
  
          val localVariableConfig = RequestConfig(
              RequestMethod.POST,
              "/api/MobileAPI/GetProvider",
              query = localVariableQuery,
              headers = localVariableHeaders
          )
          val response = request&lt;kotlin.Array&lt;ProviderData&gt;&gt;(
              localVariableConfig,
              localVariableBody
          )
  
          return when (response.responseType) {
              ResponseType.Success -&gt; (response as Success&lt;*&gt;).data as kotlin.Array&lt;ProviderData&gt;
              ResponseType.Informational -&gt; TODO()
              ResponseType.Redirection -&gt; TODO()
              ResponseType.ClientError -&gt; throw ClientException((response as ClientError&lt;*&gt;).body as? String ?: "Client error")
              ResponseType.ServerError -&gt; throw ServerException((response as ServerError&lt;*&gt;).message ?: "Server error")
              else -&gt; throw kotlin.IllegalStateException("Undefined ResponseType.")
          }
      }   
  </code></pre>
  
  <p>I add in my activity the following code:</p>
  
  <pre><code>val params = HashMap&lt;String, String&gt;()
          MobileAPIApi().apiMobileAPIGetProviderPost(params,0,50,null,null,
              object : Response.Listener&lt;List&lt;ProviderData&gt;&gt;() {
                  fun onResponse(response: List&lt;ProviderData&gt;?) {
                      if (response != null &amp;&amp; response.size != 0) {......}
  </code></pre>
  
  <p>My problem is here, why couldn't use Response.Listener like in Java, and how can i replace it.  </p>