OnClickListener in TextInputEditText wrapped around TextInputLayout

The calendar opening only on the second click is because you are using an edittext. On the first click, your Edit Text will get focus. then the second click only calls the onClickListener.

If you are not looking forward to edit the date set manually (using keyboard), then why not using a TextView to display the selected Date?.

Show Calendar on First Click :

If you need to use EditText and load the calender in the first click, then try setting an onFocusChangeListner to the editText instead of onClickListner.

editText.setOnFocusChangeListener(new OnFocusChangeListener() {
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if(hasFocus) {
           // Show your calender here 
        } else {
           // Hide your calender here
        }
    }
});

I answered the linked question with an improved solution that does not affect keyboard navigation but still allows you to have the desired focus behaviour.

See https://stackoverflow.com/a/62875800/9901599, but the crux of it is to not set any focus-related XML attributes, and do this in code:

editText.setOnFocusChangeListener { view, isFocused ->
    if (view.isInTouchMode && isFocused) {
        view.performClick()  // picks up first tap
    }
}
editText.setOnClickListener {
    showDatePicker() // the actual thing you want to do
}

Set the attribute android:focusableInTouchMode to false, like this:

android:focusableInTouchMode="false"

in your edittext xml code. For more information, visit here