title: Android printing json array output on a textview
body: <p>I have an android app that should parse json array output from a web service 
  I tested the output with a java application and it works fine.
  My purpose here to print  one of the output in a textview but I failed</p>
  
  <p>class JsonReader</p>
  
  <pre><code>public class JsonReader 
  {
  private static String readAll(Reader rd) throws IOException {
  StringBuilder sb = new StringBuilder();
  int cp;
           while ((cp = rd.read()) != -1)
           {
           sb.append((char) cp);
                                }
            return sb.toString();
                                        }
  
        public static JSONArray readJsonFromUrl(String url) throws IOException, JSONException
        {
         InputStream is = new URL(url).openStream();
         try 
         {
         BufferedReader rd = new BufferedReader(new InputStreamReader(is,  Charset.forName("UTF-8")));
         String jsonText = readAll(rd);
          JSONArray json = new JSONArray(jsonText);
          return json;
          }
          finally 
          {
            is.close();
          }
             }
  
        public JsonReader() throws JSONException, IOException
        {
  
        }  
  
        }
  </code></pre>
  
  <p>MainActivity </p>
  
  <pre><code>  public class MainActivity extends Activity {
  
    @Override
     protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  final TextView uid = (TextView)findViewById(R.id.editText1);
      try
      {
      JsonReader r = new JsonReader();
      JSONArray json = r.readJsonFromUrl ("http://localhost:8888/derdeery/zaki.php");
  
   for (int i =1; i &lt; json.length(); ++i)
   {
   JSONObject  jsons =json.getJSONObject(i);
  
   int service_ID = jsons.getInt("service_ID");
   String Site_comment = jsons.getString("site_comment");
   String Img_Link = jsons.getString("img_link"); 
   uid.setText(Site_comment);
  
  }
  
      }
  catch(Exception e)
         { }}}
  </code></pre>
  
  <p>My xml file</p>
  
  <pre><code>   &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity" &gt;
  
      &lt;EditText
      android:id="@+id/editText1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="60dp"
      android:ems="10" /&gt;
  </code></pre>
  
  <p></p>