I modified this sample code of a gridview calendar. I want to show just a single row (i.e. a week), so I added the line if (list.size() != 7)
and it gives me the current week (seven days).
Now I want to show next week 7 days when the user click on a button. How can I do that?
Below is my code which displays current week:
int t;
btnnextweek.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
// TODO Auto-generated method stub
t=7;
adapter = new GridCellAdapter(getApplicationContext(), R.id.calendar_day_gridcell, month, year);
adapter.notifyDataSetChanged();
calendarView.setAdapter(adapter);
}
});
// Current Month Days
for (int i = 1; i <= daysInMonth; i++)
{
Log.d(currentMonthName, String.valueOf(i) + " " + getMonthAsString(currentMonth) + " " + yy);
if (list.size()!=7)
{
if (i == getCurrentDayOfMonth())
{
list.add(String.valueOf(i) + "-BLUE" + "-" + getMonthAsString(currentMonth) + "-" + yy);
}
else
{
list.add(String.valueOf(i) + "-WHITE" + "-" + getMonthAsString(currentMonth) + "-" + yy);
}
}
}