I need two date, the onDateSet method executes and places the selected date in the two Textview

Asked

Viewed 44 times

0

    @Override
    public void onDateSet(DatePicker datePicker, int year, int month , int dayOfMonth) {
        //função execultada apos a escolha da data
        dataSelecionada = String.format("%02d/%02d/%d", dayOfMonth, ++month, year);
        data.setText(dataSelecionada);
        data2.setText(dataSelecionada);
    }

    public DatePickerFragment(TextView data, TextView data2){
       this.data = data ;
       this.data2 = data2;
    }

}

public void AbrirCalendario() {
    // abrir calendario
    DialogFragment calendario = new DatePickerFragment(data, data2);
    // suporte fragment, string de indentificação do fragment
    calendario.show(getSupportFragmentManager(), "datepicker");
}
  • I don’t understand your doubt

  • Be a little more specific about your doubt.

  • I need a check-in date and an check-out date for room rental, but the selected date formatting takes the same date as the Datepicker and puts it on both Textview, I don’t know how else to use it

  • The tag android-studio should only be used for questions related to the IDE.

  • Can’t help you without knowing where they’re coming from date and date2 .

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.