setting properties in EditText android:inputtype= "Numberdecimal" in some Samsung phones (s5830i) causes its native input method to crash. If you set the property to Android:inputtype= " Number "will not crash. Originally these input method calls do not support floating-point numbers, only can support integers.
TextEdit Setting monitoring
Filter empty strings, non-floating-point numbers, starting with 0 (for example, 0123.11)
String regEx = "^[0-9]+\\." {0,1} [0-9] {0,2}$ ";//Regular expression input can only be floating-point number, followed by 2 decimal digits
<span style= "FONT-SIZE:14PX;" >priceet.addtextchangedlistener (New Textwatcher () {@Overridepublic void ontextchanged (charsequence s, int start, int Before,int count) {if (s! = null) {if ("."). Equals (Txt_amount.gettext (). toString (). Trim ()) | | ! (Pattern.matches (RegEx, Txt_amount.gettext (). toString (). Trim ()))) {String str = Txt_amount.gettext (). toString (). Trim (); if (Txt_amount.gettext (). toString (). Length () >= 1) {txt_amount.settext (str.substring (0), Txt_amount.gett Ext (). toString (). Length ()-1)); Txt_amount.setselection (Txt_amount.gettext (). toString (). Length ()); }}}} @Overridepublic void Beforetextchanged (charsequence s, int start, int count,int after) {} @Overridepublic void Aftertextchanged (Editable s) {}}); </span>
Note An attribute in XML: android:digits= "0123456789."
Dights limit only input 0~9 and '. ' These data types, other formats do not support
<span style= "FONT-SIZE:14PX;" ><edittext android:id= "@+id/money" android:layout_width= "fill_parent" android:layout_height= "60DP" android:background= "@null" android:singleline= "true" android:digits= "0123456789." android:imeoptions= "Actionnext" android:maxlength= "7"/></span>
Complete the above two steps, you can implement the custom floating point data, the low-end machine will not appear to call the API Numberdecimal type, input method error.
Android Input Method problem solved Samsung s5830i or Huawei Low-end machine input crash problem