Android: Clear keyboard input when edittext is cleared -
i want set automatic thousand separator edittext. did textwatcher. in
public void aftertextchanged(editable s)
i save current value of edittext, format with
@override public void aftertextchanged(editable s) { inputfield.this.removetextchangedlistener(this); double tmp = getdoublevalue(); s.clear(); s.append(decimalformat.getinstance(locale.german).format(tmp)); inputfield.this.addtextchangedlistener(this); } });
but keyboard galaxy tab doesn't care if clear editable. keeps current input , fills edittext complete number. short example:
i type "1", keyboard inserts "1", edittext shows "1".
type "2", keyboard inserts "12", edittext shows "112"
type "3", keyboard inserts "123", edittext shows "112.123"
press delete button, keyboard inserts "12", edittext shows "11.212.312" press delete button again, keyboard inserts "1", edittext shows "112.123.121"
my question is: how can disable keyboardfeature?
or how can clean keyboard "cache"?
if use inputtype "numberdecimal", works can't use points thousand separators(but needed in germany), because interpreted decimal mark , there can one.
i not sure if can clean cache, how disabling suggestion bar.. can programatically:
youredittext.setinputtype(youredittext.getinputtype() | editorinfo.type_text_flag_no_suggestions | editorinfo.type_text_variation_filter);
or can deactivate in edittext
xml tag.. can set:
<edittext> android:inputtype="textfilter .... />
you can use value unfortunately doesn't work in devices specially htc
android:inputtype="textnosuggestions"
edit
sometimes doesn't work because it's implementation of keyboard right thing including flags.. however, has workaround can try following code in xml:
android:inputtype="textnosuggestions|textvisiblepassword"
or in java:
youredittext.setinputtype(inputtype.type_text_flag_no_suggestions | inputtype.type_text_variation_visible_password);
and give me feedback if worked or not..
Comments
Post a Comment