I have an AlertDialog
in which I am setting a XML
as its view. In that xml layout
I have an EditText
. But after entering data in EditText
, if I am trying to delete using backspace, the characters are not getting deleted (its like backspace is not working).
Am I missing something? I searched but did not get any proper solution except adding keylistener. I think it should work simple?
Anyone there to help me.
Here is my EditText
<EditText
android:id="@+id/TextBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text">
<requestFocus />
</EditText>
Dialog ceation code:
hintDialog = new AlertDialog.Builder(activity)
.setTitle("Enter Your Hint:")
.setView(hintDialogView).create();
hintDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK)
hintDialog.dismiss();
return true;
}
});
AlertDialog
creation portion – Zarzuela