I want to click a edittext and show dialog date so I try
mDateDisplay = (EditText) findViewById(R.id.dateDisplay);
mDateDisplay.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
showDialog(DATE_DIALOG_ID);
}
}
});
The dialog will show if mDateDisplay is a button
but I want to use edittext
what should I do?
You can use OnClickListener event to handle the dialog box but after disabling the android:focusableInTouchMode
of EditText in the xml file like this.
eg - android:focusableInTouchMode="false"
.
Because when the EditText is first touched it calls the focus event and on second touch it call the click event so you have to disable the focus event first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With