Note that there are some explanatory texts on larger screens.

plurals
  1. POGet response rest web services Using Java for Android
    primarykey
    data
    text
    <p>the following code I produced following a tutorial on web services, but nothing is happening although no error is given. Can anyone help me please? as I cannot continue. I need to connect to a web service and this is not working.</p> <p>Using the debugger i found out that it is stopping in the first method on this particular line: HttpResponse response = client.execute(request);</p> <pre><code>private String result = ""; public void getResponse() { HttpClient client = new DefaultHttpClient(); String query ="working url"; try { URL url = new URL(query); URI uri = new URI(url.getProtocol(), url.getHost(),url.getPath(), url.getQuery(),null); HttpGet request = new HttpGet(uri); HttpResponse response = client.execute(request); result=Userrequest(response); } catch(Exception ex) { } } public String Userrequest(HttpResponse response) { try { InputStream in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while((line = reader.readLine()) != null) { str.append(line + "\n"); } in.close(); result = str.toString(); updateData(result); } catch(Exception ex) { //responsetxt.setText(ex.getMessage()); } return result; } public void updateData(String result) { try { JSONObject json = new JSONObject(result); JSONArray ja; json = json.getJSONObject("responseData"); ja = json.getJSONArray("results"); int resultCount = ja.length(); for (int i =0; i&lt;resultCount; i++) { JSONObject resultObject = ja.getJSONObject(i); result = resultObject.toString(); } } catch(Exception ex) { //responsetxt.setText(ex.getMessage()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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