Issue
I saw many answers for comparison between Volley and Retrofit. But I'm unable to find any answer for why both came to front. What were the issues/bugs/problems in AsyncTask or what were the problems in simple HTTP client/server programs.
Solution
Actually Volley and Retrofit are libraries where AsyncTask is a way of threading.
SimpleHttpClient is an implementation to do HTTP requests, But you will have to handle everything manually like parsing the response and so many. It runs on whichever thread you are calling it from. To run it in a separate thread you will have to create an AsyncTask.
But, Volley and Retrofit library was created to make the HTTP request very simple by reducing boilerplate code. Using this you have to write only a few lines of codes to make an HTTP request and the HTTP requests will be pushed to separate thread automatically.
If SimpleHttpClient and AsyncTask are written in 30lines of code, you can achieve the same using Retrofit or volley in within 6 to 8 lines of code.
Answered By - Sujith Niraikulathan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.