Android json response in array
<p>The following code shows only the first record. Can anyone correct my mistake.</p>

<p>Using this try i established connection with php  </p>

<pre><code>try{    
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://10.0.2.2/androidphp/1/index.php");
            httppost.setEntity(new UrlEncodedFormEntity(namevaluepairs));
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity entity = response.getEntity();
            is = entity.getContent();
            if(response.getStatusLine().getStatusCode() != 200){
                Log.d("MyApp", "Server encountered an error");
            }

try{

            BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF8"));
            sb= new StringBuilder();
            sb.append(reader.readLine() + "\n");
            String line = null;

            while((line = reader.readLine()) != null){
                sb.append(line + "\n");
            }
            is.close();
            result = sb.toString();
        }
</code></pre>

<p>Using this try block i printed all values</p>

<pre><code>try{
                jArray = new JSONArray(result);
                JSONObject json_data = null;
                for(int i=0; i&lt;jArray.length(); i++){
                    json_data = jArray.getJSONObject(i);
                    outputStream.append("Id="+json_data.getString("id"));
                    outputStream.append("Name="+json_data.getString("name"));
                }
</code></pre>
