Posted By Our Mentors
Amreen Khan
Android Developer
animesh bansal
iphone App Developer
Devendra chouksey
Android Developer
Dilip Saket
IOS apps developer
Hemraj Jhariya
iOS Developer
Jaihind singh Rajput
Smart Phone App Dev
Mujahid khan
Android developer
Narendra Yadav
android developer
Narinder Gupta
Mobile App Architect
Pradeep singh Thakur
Mobile App Architect
Sanjay Sharma
Andriod Developer
Shakti Rajpal
IT Architect
Soniya Vishwakarma
iPhone App Developer
Sunil Raghuwanshi
iPhone App Developer
Supriya Kapse
Senior developer
View current Topics
How to make time bound HTTP requests in android Android
In this tutorial, we are going to see how we can make http request that tries to be executed within certain amount of time only. If response does not come with in particular time period, request is simply cancelled.
Posted By: Mujahid khan Date: 30 Jun 2012 View: 912
      Rate This !!


We make use of our custom class i.e HttpRequestHandler class to achieve our goal. We simply create an instance of this class and set the timeout duration by calling the setTimeDuration(int duration) method on our newly created instance. Then we simply invoke getHttpresponse(String URL) method to get the response within the duration we set. If server responds and data is got within that duration, it is returned by getHttpResponse() method else string containing “error” is returned.

Complete class with source code can be downloaded from the link provided below.

NOTE: URL is the url from which you expect the response to come.

Any queries or suggestions are most welcome.

Regards,

Mujahid Hussain Khan

Vincent IT


Posted Queries