title: JSON Parsing in Android for pulling Boolean/Integer values
body: <p>I am new to JSON and I was wondering how I would pull some info and put it into a JSON Object and then read some of the values. The json info looks like this,</p>
  
  <pre><code>{
      "photos":{
          "page":1, 
          "pages":1802,
           "perpage":100,
           "total":"180134", 
           "photo": [
              {
                  "id":"8711964781", 
                  "owner":"21156896@N07", 
                  "secret":"3e24e45977", 
                  "server":"8553", 
                  "farm":9, 
                  "title":"Old Harbor", 
                  "ispublic":1, 
                  "isfriend":0, 
                  "isfamily":0
              }, 
              {
                  "id":"8712680696", 
                  "owner":"21156896@N07", 
                  "secret":"fe82f8387b", 
                  "server":"8122", 
                  "farm":9, 
                  "title":"Rockefeller Plaza", 
                  "ispublic":1, 
                  "isfriend":0, 
                  "isfamily":0
              }, 
              ....
  </code></pre>
  
  <p>It photo array goes on for quite a while. How would I get the values of "isPublic"? "Secret" is a String because of the "" and isPublic is an integer or boolean? I basically have to put them into a URL link and download the image. </p>
  
  <pre><code>public class ReadString extends AsyncTask&lt;String, Integer, String&gt;{
  @Override
          protected String doInBackground(String... FlickrString) {
              try {
                  json = getValue();
                  return json.getString(FlickrString[0]);
              } catch (ClientProtocolException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              return null;
          }
  @Override
          protected void onPostExecute(String result) {
              // TODO Auto-generated method stub
              tvTest.setText(result);
          }   
  </code></pre>
  
  <p>This works for all the strings. How would I get the farm, isfriend, isfamily, and ispublic converted to a string? I tried something else now to get the Int values, I made a whole new class for reading the ints. But it isnt getting the correct int value. I have it download the int and I convert it to a string and then I change a textview to the string of the int using String.valueOf(x); What am i doing wrong? </p>
  
  <pre><code>public class ReadInt extends AsyncTask&lt;String, Integer, String&gt;{
  
          @Override
          protected String doInBackground(String... FlickrString) {
              try {
                  json = getValue();
                  int x = json.getInt(FlickrString[0]);
                  String y = String.valueOf(x);
                  return y;
              } catch (ClientProtocolException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(String result) {
              // TODO Auto-generated method stub
              tvTest.setText(result);
          }   
      }   
  </code></pre>
  
  <p>Thanks!</p>