Android Custom Dialog Display -
my custom dialog layout has 2 edit text fields.
<edittext android:id="@+id/e2" android:inputtype="none" android:longclickable="false" android:selectallonfocus="true" android:textisselectable="true" /> <edittext android:id="@+id/e2" android:inputtype="none" android:longclickable="false" android:selectallonfocus="true" android:textisselectable="true" />
i implement class using onfocuschangelistener.
my idea when click text field, 1 custom popup dialog appears select pre-defined value.
it work correctly have minor problem.
if click editext 1 => dialog apear (i select button dismisses) => click editext 2 => dialig appear (i select button dismisses).
however, if if click editext 1 => dialog appears (i select button dismisses), click on editext 1 again (even many times try), dialog not show (in expectation, should appear whenever click).
my class
public class user_input extends activity implements onfocuschangelistener { @override public void onfocuschange(view v, boolean hasfocus) { final edittext edt = (edittext) findviewbyid(v.getid()); if (hasfocus) { final dialog dialog = new dialog(user_input.this); dialog.setcontentview(r.layout.input_dialog); dialog.settitle("select number: "); dialog.show(); btn1 = (button) dialog.findviewbyid(r.id.val1); btn1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { edt.settext("1"); dialog.cancel(); } }); btn2 = (button) dialog.findviewbyid(r.id.val2); btn2.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { edt.settext("2"); dialog.cancel(); } }); } }
how show expectation? thank in advanced.
Comments
Post a Comment