Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just suggesting a simple way to do the desired... For more details refer and study the tutorial...<a href="https://stackoverflow.com/questions/5867544/android-json-parsing-tutorial/9742384#9742384">https://stackoverflow.com/questions/5867544/android-json-parsing-tutorial/9742384#9742384</a> </p> <pre><code>public void parseData throws Exception { try { HttpClient httpclient = new DefaultHttpClient(); // Prepare a request object HttpGet httpget = new HttpGet("http://services.digg.com/2.0/digg.getAll"); // Execute the request HttpResponse response; // Get hold of the response entity HttpEntity entity = response.getEntity(); // If the response does not enclose an entity, there is no need // to worry about connection release if (entity != null) { // A Simple JSON Response Read // InputStream instream = entity.getContent(); // String result = convertStreamToString(instream).trim(); String result = EntityUtils.toString(entity); JsonObject json = new JsonObject(result); JSONArray diggsJsonArray = json.getJSONArray("diggs"); for(int i =0;i&lt;diggsJsonArray.length;i++) { JsonObject individualDiggsObj = diggsJsonArray.getJSONObject(i); DiggItem di = new DiggItem(); di.setDate(individualDiggsObj.getInt("date")); di.setDiggId(individualDiggsObj.getString("digg_id")); JSONOnejct itesmJson = new JSONOBJECT(individualDiggsObjgetJSONObject("item"); //NOw Fetch and Set the values of status,title,description,, etc from the itemsJson to your collection. //Similarly begin with other inner Array's and Object's if available. }catch(Exception e) { e.printStackTrace(); } </code></pre>
 

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