Skip to content

Instantly share code, notes, and snippets.

package com.runningbus;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
package com.runningbus.get;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONException;
@johnsonyeap
johnsonyeap / gist:2da5f6410d33d20ef4a0
Created August 6, 2014 01:58
HTTP in doInBackground of AsyncTask
package com.runningbus.put;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
@johnsonyeap
johnsonyeap / Survey
Created July 16, 2014 12:48
This is an example exercising GET Method and POST Method in Android by using HttpURLConnection class.
package com.mitgsl.johnsonyeap.androidassignment2;
import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;