Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>this is the function for passing json to your URL</p> <pre><code>public void getServerData() throws JSONException, ClientProtocolException, IOException { String title = Title_edittext.getText().toString().trim(); String details = Details_edittext.getText().toString().trim(); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC); HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC); HttpClient client = new DefaultHttpClient(httpParams); HttpPost request = new HttpPost(url); // add your url here... request.setHeader( "Content-Type", "application/json" ); JSONObject json = new JSONObject(); json.put("client_id", channel_token); json.put("date_from", data_src_id); json.put("date_to", title); Log.i("JSON Object", json.toString()); StringEntity se = new StringEntity(json.toString()); se.setContentEncoding("UTF-8"); se.setContentType("application/json"); request.setEntity(se); HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); String _response = convertStreamToString(is); System.out.println("res-- " + _response); // Check if server response is valid code int res_code = response.getStatusLine().getStatusCode(); System.out.println("code-- " +res_code); } private static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is), 8192); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append((line + "\n")); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload