Reputation: 1333
I am developing an Android application. Now on the click of the Spinner
the calendar will open.Now that calendar should be in week view and on click of the specific date I have to call one Activity
as per my requirement.Anybody guide me for this.
Thanks for your time.
Upvotes: 0
Views: 3017
Reputation: 6612
Try this,
Calendar c;
int date;
int month;
int year;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.change_booking_date);
c = Calendar.getInstance();
dates = new String[7];
date = c.get(Calendar.DAY_OF_MONTH);
month = c.get(Calendar.MONTH)+1;
year = c.get(Calendar.YEAR);
}
Increment the dates and update them accordingly.
public void updateDate() {
if (date > c.getMaximum(Calendar.DAY_OF_MONTH)) {
date = 1;
month++;
updateMonth();
}
else
date++;
}
public void updateMonth() {
if (month > c.getMaximum(Calendar.MONTH)) {
month = 1;
year++;
}
else
month++;
}
Upvotes: 1