title: Using AsyncTask with Runnable
body: <p>I have the following code in my repository:</p>
  
  <pre><code>class BusRepositoryImpl(
      private val busService: BusService
  ) : BusRepository 
  
      override fun get(id: String, callback: Callback&lt;BusItem&gt;){
              AsyncTask.execute {
                  try {
                      val apiResponse = busService.get(id)
                      callback.onResponse(apiResponse.bus)
                  }
                  catch (e: Exception){
                      callback.onFailure(e)
                  }
              }
          }
  }
  </code></pre>
  
  <p>busService:</p>
  
  <pre><code>class BusServiceImpl(private val baseUrl: String, private val httpClient: HttpClient) 
       override fun get(id: String): ApiResponse {
             return httpClient.get("${baseUrl}/bus/$id")
       }
  </code></pre>
  
  <p>ViewModel:</p>
  
  <pre><code> fun get(id: String) {
          busRepository.get(id, object: Callback&lt;BusItem&gt;{
              override fun onResponse(data: BusItem) {
                  busLiveData.postValue(data)
              }
  
              override fun onFailure(t: Throwable) {
                  errors.postValue(t)
              }
  
          })
      }
  </code></pre>
  
  <p>It works so far, but I'd like to know if using <code>AsyncTask</code> like this can lead to any problems. I heard about <code>AsyncTask</code> being a bad solution that is soon to be deprecated by Google so I'm in doubt. If theres any other alternative to execute my request on a background thread I would appreciate if you could indicate it.</p>
  
  <p>I dont want to use Retrofit or any similar alternatives.</p>