Sunday, January 26, 2014

Exception With DefaultHttpClient execute

Not executing the DefaultHttpClient task on a separate thread will throw you an exception.

Create a new class that extends AsyncTask then override the doInBackground() method to execute DefaultHttpClient.

AsyncTask will create a separate thread and execute the code in doInBackground(). Be careful however, AsyncTask will stay alive until finish() or cancel() is called. This may potentially cause memory leak issues.

No comments:

Post a Comment