title: In Android, trying to display Google Calendar JSON data
body: <p>I've got a working Calendar in my Android app. My goal is to add events to this calendar from the calendar associated with one my other Google accounts. I've discovered that in order for the app to see the events, I have to make the Google calendar public, so that not only my app, but everybody can see the calendar. I know that the Google calendar is set up correctly because I can see the JSON data from it. The URL to parse the JSON data is: <code>http://www.google.com/calendar/feeds/[my other calendar]@gmail.com/public/full</code>. So my question then is <strong>How do I parse this JSON data into my app?</strong> I imagine I'd have to make a JSON parsing class, then reference that JSON Parsing class in my Calendar Activity. Here's what my Calendar Class looks like: `  </p>
  
  <pre><code>import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.GregorianCalendar;
  import java.util.Locale;
  
  import android.app.Activity;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.os.Handler;
  import android.util.Log;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.GridView;
  import android.widget.LinearLayout;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.Button;
  import android.content.Intent;
  
  public class Calendar32View extends Activity {
  
  public GregorianCalendar month, itemmonth;// calendar instances.
  
  public Calendar31Adapter adapter;// adapter instance
  public Handler handler;// for grabbing some event values for showing the dot
                          // marker.
  public ArrayList&lt;String&gt; items; // container to store calendar items which
                                  // needs showing the    event marker
  ArrayList&lt;String&gt; event;
  LinearLayout rLayout;
  ArrayList&lt;String&gt; date;
  ArrayList&lt;String&gt; desc;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.cal3_2);
      Locale.setDefault(Locale.US);
  
      rLayout = (LinearLayout) findViewById(R.id.text);
      month = (GregorianCalendar) GregorianCalendar.getInstance();
      itemmonth = (GregorianCalendar) month.clone();
  
      items = new ArrayList&lt;String&gt;();
  
      adapter = new Calendar31Adapter(this, month);
  
      GridView gridview = (GridView) findViewById(R.id.gridview);
      gridview.setAdapter(adapter);
      handler = new Handler();
  
      // ---
      //handler.post(calendarUpdater);//--- adds Events
      // ----
  
      TextView title = (TextView) findViewById(R.id.title);
      title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
  
      // --- Previous Month Button
      RelativeLayout previous = (RelativeLayout) findViewById(R.id.previous);
      previous.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              setPreviousMonth();
              refreshCalendar();
          }
      });
      // --- END Previous Month Button
  
      // --- Next Month Button
      RelativeLayout next = (RelativeLayout) findViewById(R.id.next);
      next.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              setNextMonth();
              refreshCalendar();
  
          }
      });
      // --- END Next Month Button
  
      // --- onClick of date ----
  
      gridview.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v,
                  int position, long id) {
  
              // removing the previous view if added
              if (((LinearLayout) rLayout).getChildCount() &gt; 0) {
                  ((LinearLayout) rLayout).removeAllViews();
              }
          }
  
      });
  
      // --- END onClick of date ----
  
  }// --- END onCreate
  
  // ---- METHODS ---
  
  protected void setPreviousMonth() {
      if (month.get(GregorianCalendar.MONTH) == month
              .getActualMinimum(GregorianCalendar.MONTH)) {
          month.set((month.get(GregorianCalendar.YEAR) - 1),
                  month.getActualMaximum(GregorianCalendar.MONTH), 1);
      } else {
          month.set(GregorianCalendar.MONTH,
                  month.get(GregorianCalendar.MONTH) - 1);
      }
  
  }// --- end method
  
  protected void setNextMonth() {
      if (month.get(GregorianCalendar.MONTH) == month
              .getActualMaximum(GregorianCalendar.MONTH)) {
          month.set((month.get(GregorianCalendar.YEAR) + 1),
                  month.getActualMinimum(GregorianCalendar.MONTH), 1);
      } else {
          month.set(GregorianCalendar.MONTH,
                  month.get(GregorianCalendar.MONTH) + 1);
      }
  
  }// --- END Method
  
  protected void showToast(String string) {
      Toast.makeText(this, string, Toast.LENGTH_SHORT).show();
  
  }// --- end method
  
  public void refreshCalendar() {
      TextView title = (TextView) findViewById(R.id.title);
  
      adapter.refreshDays();
      adapter.notifyDataSetChanged();
  
      title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
  }// --- end method
  
  
  
  // --- END METHODS -----
  
  }`
  </code></pre>
  
  <p>I can't seem to find any tutorials on how to do this. I'm targeting SDK 8, so that it can run on my 2.3.4 phone.</p>