My application has 3 edit texts: first name, last name, birthday.

I disabled the keyboard for birthday (state hidden used in XML) and instead a DatePicker appears when it is clicked. However, after typing in the last name you could click next on the keyboard and it would go down to birthday causing the keyboard to appear again.

Within my XML I wrote for birthday edit text:

    android:hint="@string/birth" />

How can I make the next button have the datepicker appear instead of the keyboard?

Additionally, I use an OnClickListener for the datepicker to appear. When I touch the edit text field for birthday it does not show up until I click the field one more time. I tried using onTouchListener but that just makes the DatePicker appear twice (after I select the date the date picker screen appears again resetting the date I selected) How can I fix this?

public void onClick(View v) 
    DialogFragment calendar = new DatePickerFragment(){
       public void onDateSet(DatePicker view, int year, int month, int day) {
            dob.setText("" + year + "-" + (month+1) + "-" + day);
    };, "datePicker");

Related posts

Recent Viewed