Note that there are some explanatory texts on larger screens.

plurals
  1. POJson object displaying on listview
    text
    copied!<pre><code> public ArrayList&lt;String&gt; getData() { ArrayList&lt;String&gt; listItems = new ArrayList&lt;String&gt;(); String result = ""; InputStream isr=null; try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.0.2.2/get_data.php"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); isr = entity.getContent(); } catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); //resultView.setText("Couldnt connect to database"); } try{ BufferedReader reader = new BufferedReader(new InputStreamReader(isr,"iso- 8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } isr.close(); result=sb.toString(); } catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } //parse json data try { String s = ""; JSONArray jArray = new JSONArray(result); for(int i=0; i&lt;jArray.length();i++) { JSONObject json=jArray.getJSONObject(i); listItems.add(json.getString("name")); listItems.add(json.getString("ph.no")); listItems.add(json.getString("id")); // adding HashList to ArrayList } // resultView.setText(s); } catch (Exception e) { // TODO: handle exception Log.e("log_tag", "Error Parsing Data "+e.toString()); } return listItems; // selecting single ListView item } </code></pre> <p>I am developing an android application called phone book. I am extracting details of person from sever as json object. Displaying details on android</p> <p>I am able to display contact details of a particular person in different rows. How to display details of a single person on same row.</p>
 

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