Hello,

I am not so familiar with OkHttp library and I have some doubts on how it 
should be used for async requests. I was using the android library for *http 
*and I was using *asyncTask* for some request. 

But since I wanted to try OkHttp library, I faced some "problem" on what is 
the correct way it should be used.


Imagine you want to implement async request using OkHttp. I read that 
OkHttp have it's own async api ( 
https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/AsynchronousGet.java
 
). 


But then I came across this post (
http://stackoverflow.com/questions/26114299/squares-okhttp-download-progress) 
in which the guy used the "old" asyncTask but with OkHttp request ( I also 
found on other forums that people are using AsyncTask with OkHttp).


But OkHttp have its own async api, that's why is confsing for me,why people 
continue to use AsyncTask.


*So my questions:*

   1. What is the correct way to use async requests with OkHttp?
   2. Is it a good practice to use AsyncTask with OkHTTP?
   3. How I understood, both , Okhttp async api and AsyncTask can do 
   similar things. Then waht is the difference? why and in which cases should 
   I choose one instead of the other?


Thank you!

Cheers









-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/989ace15-a330-4c06-9a25-81ce9fea2a66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to