So i am a newbie to android.i am very much confused right now.tell me what is the difference between HTTPUrlConnection and HTTPClient And which is preferable while fetching the data from web
HttpClient is deprecated and should not be used for any new applications. HttpUrlConnection was originally meant to be it's replacement, it has fewer apis but is smaller and more lightweight. However, some attractive competitors have emerged for HttpUrlConnection, including okHttp, Retrofit and Volley (from square and google respectively).
Unless you have some specific needs from the library (intercepting requests and modifying the headers for example), I would recommend going with okHttp as it has a larger community and is more robust.
This SO post and search which-android-http-library-to-use
do a good job describing your options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With