public class GetJsonParser extends AsyncTask<string,> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(getActivity());
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected JSONObject doInBackground(String... args) {
// TODO Auto-generated method stub
//
// HttpClient httpclient = new DefaultHttpClient();
// HttpParams myParams = new BasicHttpParams();
// HttpConnectionParams.setConnectionTimeout(myParams, 10000);
// HttpConnectionParams.setSoTimeout(myParams, 10000);
//String url = args[0];
//String json=args[1];
// JSONObject JSONResponse = null;
// InputStream contentStream = null;
// String resultString = "";
try {
JSONObject jsonObj = new JSONObject();
// jsonObj.put("username", username);
jsonObj.put("Api-Key","T6G4ryFDjTnG4s1");
// Create the POST object and add the parameters
HttpGet httpPost = new HttpGet(url);
StringEntity entity = new StringEntity(jsonObj.toString(), HTTP.UTF_8);
entity.setContentType("application/json");
entity.setContentType("application/json");
((HttpResponse) httpPost).setEntity(entity);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(httpPost);
System.out.print(response);