How to show calender in year wise in android
<p>HI in my application i need to show calender in year wise...i tried with the following code</p>

<pre><code>    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.calendar);
    month = Calendar.getInstance();
    onNewIntent();

    gridlayout1=(LinearLayout)findViewById(R.id.gridlayout1);
    gridlayout2=(LinearLayout)findViewById(R.id.gridlayout2);

    handler = new Handler();
    items = new ArrayList&lt;String&gt;();
    adapter = new CalendarAdapter(this, month); 
</code></pre>

<p>//      TextView title  = (TextView) findViewById(R.id.title);
//      title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));</p>

<pre><code>    for(int i=0;i&lt;12;i++)
    {
        final View view = getLayoutInflater().inflate(R.layout.grid, null);
</code></pre>

<p>//          items = new ArrayList();
//          adapter = new CalendarAdapter(this, month);  </p>

<pre><code>        GridView gridview = (GridView) view.findViewById(R.id.gridview);
        gridview.setAdapter(adapter);

        TextView title  = (TextView) view.findViewById(R.id.title);
        title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
        Log.e("month",""+android.text.format.DateFormat.format("MMMM yyyy", month));
</code></pre>

<p>//          if(i==0)        handler.post(calendarUpdater);</p>

<pre><code>    if(month.get(Calendar.MONTH)== month.getActualMaximum(Calendar.MONTH)) {                
        month.set((month.get(Calendar.YEAR)+1),month.getActualMinimum(Calendar.MONTH),1);
    } else {
        month.set(Calendar.MONTH,month.get(Calendar.MONTH)+1);
    }

    refreshCalendar();
    if(i&lt;6)
    gridlayout1.addView(view);
    if(i&gt;5)
    gridlayout2.addView(view);

}
public void refreshCalendar()
{
</code></pre>

<p>//      TextView title  = (TextView) findViewById(R.id.title);</p>

<pre><code>    adapter.refreshDays();
    adapter.notifyDataSetChanged();             
    handler.post(calendarUpdater); // generate some random calendar items               
</code></pre>

<p>//      title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
    }</p>

<pre><code>public void onNewIntent() {
    String date = "2012-00-01";
    String[] dateArr = date.split("-"); // date format is yyyy-mm-dd
    month.set(Integer.parseInt(dateArr[0]), Integer.parseInt(dateArr[1]), Integer.parseInt(dateArr[2]));
}

public Runnable calendarUpdater = new Runnable() {

    @Override
    public void run() {
        items.clear();
        // format random values. You can implement a dedicated class to provide real values
        for(int i=0;i&lt;31;i++) {
            Random r = new Random();

            if(r.nextInt(10)&gt;6)
            {
                items.add(Integer.toString(i));
            }
        }

        adapter.setItems(items);
        adapter.notifyDataSetChanged();
    }
};
</code></pre>
