在Android的Google日历的周视图视图、日历、Android、Google

2023-09-09 21:04:03 作者:簡單の愛

我开发一个Android应用程序。现在的点击微调的日历将open.Now该日历应该在周视图和具体的日期我要打电话有一个活动按我requirement.Anybody指导我的。

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.

感谢您的时间。

推荐答案

试试这个,

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++;
}