Mark, Thanks for the link, a lot of good examples. I try to use
BasicResponseHandler but I am still getting the same error. Could it
be something with Eclipse?
org.json.JSONException: A JSONObject text must begin with '{' at
character 1
DefaultHttpClient client=null;
HttpClient httpclient = new DefaultHttpClient();
client=new DefaultHttpClient();
HttpParams params=new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "UTF_8");
HttpProtocolParams.setUseExpectContinue(params, false);
client.setParams(params);
HttpPost post=new HttpPost("http://brh.numbera.com/software/jsonview/
example.json");
try
{
ResponseHandler<String> responseHandler=new BasicResponseHandler();
String responseBody=httpclient.execute(post, responseHandler);
Log.v(TAG, "responseBody" + responseBody.toString());
JSONObject response=new JSONObject(responseBody);
Log.v(TAG, "Response" + response.toString());
}
catch(Exception e)
{
Log.v(TAG, "E" + e.toString());
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en