android - Implicit "Submit" after hitting Done on the keyboard at the last EditText -
i've used apps when fill username, go password, if hit "done" on keyboard, login form automatically submitted, without me having click submit button. how done?
try this:
in layout put/edit this:
<edittext android:id="@+id/search_edit" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputtype="text" android:singleline="true" android:imeoptions="actiondone" />
in activity put (e. g. in oncreate):
// text box edittext edit_txt = (edittext) findviewbyid(r.id.search_edit); edit_txt.setoneditoractionlistener(new edittext.oneditoractionlistener() { @override public boolean oneditoraction(textview v, int actionid, keyevent event) { if (actionid == editorinfo.ime_action_done) { submit_btn.performclick(); return true; } return false; } });
where submit_btn
submit button onclick handler attached.
Comments
Post a Comment