Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);
Posted
Comments
Sandeep Londhe 28-Aug-14 3:52am    
What you really want to do asked it clearly?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900