Posts

Showing posts from July, 2017

API calling using AsyncHttpClient

Today we work on AsyncHttpClient for parsing the data from an API What is AsyncHttpClient? The AsyncHttpClient can be used to make asynchronous GET, POST, PUT and DELETE HTTP requests in your Android applications. Requests can be made with additional parameters by passing a RequestParams instance, and responses can be handled by passing an anonymously overridden ResponseHandlerInterface instance.  Here I write an empty class which will hold the model object as per model class.  Model class is just a getter setter class. public class DataModel implements Serializable { }   Lets create an interface which will hold the parsing data public interface NotifyTasKDone { void onTaskDone ( DataModel in ); }     Add the following line on your gradle file dependencies {       compile 'com.loopj.android:android-async-http:1.4.9'  }     Lets create a class for taskhandler with name NetworkHandler   Here I use a gson library for parsing json data