首页 > 解决方案 > 使用 time square 获取两个选定的入住和退房日期

问题描述

我想在 2 中显示入住和退房的第一个和最后一个日期textviews我正在使用 timesquare Android studio 和 SelectionMode = RANGE 这是我的代码:

public class SelectDates extends AppCompatActivity {
TextView checkin, checkout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_dates);


        Date today = new Date();
        Calendar nextYear = Calendar.getInstance();
        nextYear.add(Calendar.YEAR, 1);

        checkin = (TextView)findViewById(R.id.checkin);
        checkout = (TextView)findViewById(R.id.checkout);

        final Button btnshowdates = (Button) findViewById(R.id.btnshowdates);
        final CalendarPickerView datePicker = findViewById(R.id.calendar);
        datePicker.init(today, nextYear.getTime())
                .inMode(CalendarPickerView.SelectionMode.RANGE)
                .withSelectedDate(today);

标签: javaandroidandroid-time-square

解决方案


推荐阅读