I need to send request, but on string
url = "http://some-site.com/api/?photos.getPhotosByCategory={"id":"1","limitOne":"3","limitTwo":"3"}";
I ve got Syntax error on tokens, delete these tokens
, the problem is in quotes...Tell me please, how I can fix it ?
url = "http://some-site.com/api/?photos.getPhotosByCategory={"id":"1","limitOne":"3","limitTwo":"3"}";
new Thread(new Runnable() {
public void run(){
HttpParams myParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(myParams, 10000);
HttpConnectionParams.setSoTimeout(myParams, 10000);
HttpClient httpclient = new DefaultHttpClient();
String json=obj.toString();
try {
httppost = new HttpPost(url.toString());
httppost.setHeader("Content-type", "application/json");
StringEntity se = new StringEntity(obj.toString());
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
httppost.setEntity(se);
HttpResponse response = httpclient.execute(httppost);
String temp = EntityUtils.toString(response.getEntity());
Log.i("tag", temp);
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
tw = (TextView)findViewById(R.id.textView1);
tw.setText( response.toString());
tw.post(new Runnable() {
public void run() {
tw = (TextView)findViewById(R.id.textView1);
tw.setText( response.toString());
}
});
}
}).start();
}