Android Open Source - nodechat-android Async Http Task






From Project

Back to project page nodechat-android.

License

The source code is released under:

Apache License

If you think the Android project nodechat-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.vt.ece4564;
//from www .ja  v  a2  s.  co m
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;

import android.os.AsyncTask;

public class AsyncHttpTask extends AsyncTask<HttpRequestInfo, Integer, HttpRequestInfo> {

  public AsyncHttpTask() {
    super();
  }

  protected HttpRequestInfo doInBackground(HttpRequestInfo... params) {
    HttpRequestInfo rinfo = params[0];
    try{
      HttpClient client = new DefaultHttpClient();
      HttpResponse resp = client.execute(rinfo.getRequest());
      rinfo.setResponse(resp);
    }
    catch (Exception e) {
      rinfo.setException(e);
    }
    return rinfo;
  }

  protected void onPostExecute(HttpRequestInfo rinfo) {
    super.onPostExecute(rinfo);
    rinfo.requestFinished();
  }
  
  
}




Java Source Code List

org.vt.ece4564.AsyncHttpTask.java
org.vt.ece4564.ChatActivity.java
org.vt.ece4564.ChatClient.java
org.vt.ece4564.ChatListAdapter.java
org.vt.ece4564.ChatUtils.java
org.vt.ece4564.HttpCallback.java
org.vt.ece4564.HttpRequestInfo.java
org.vt.ece4564.HttpUtils.java
org.vt.ece4564.JoinActivity.java
org.vt.ece4564.Options.java