Android Open Source - LightControllerApp Http Post Wrapper






From Project

Back to project page LightControllerApp.

License

The source code is released under:

GNU General Public License

If you think the Android project LightControllerApp 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 info.androidhive.tabsswipe;
/*w w  w. j a  v a 2s.co  m*/
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

public class HttpPostWrapper {
    public HttpPostWrapper(final String Url, final List<NameValuePair> nameValuePair)
    {
    Thread RequestThread = new Thread(new Runnable()
    {
      public void run()
      {
           
          try
          {
             HttpClient httpClient = new DefaultHttpClient();
              // Creating HTTP Post
              HttpPost httpPost = new HttpPost(Url);

              // Url Encoding the POST parameters
            httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));

              // Making HTTP Request
            httpClient.execute(httpPost);
          }
      catch (Exception e)
      {
        MainActivity.showToast();
      }
     }
      });
    RequestThread.start();
    }
}




Java Source Code List

info.androidhive.tabsswipe.Fragment1.java
info.androidhive.tabsswipe.Fragment2.java
info.androidhive.tabsswipe.HttpPostWrapper.java
info.androidhive.tabsswipe.MainActivity.java
info.androidhive.tabsswipe.adapter.TabsPagerAdapter.java