Input price judgment in EditText
Mtext.addtextchangedlistener (NewSimpleeditwatcher () {@Override Public voidaftertextchanged (Editable s) {FinalString Text = s = =NULL? "": S.tostring (); Mclickbutton= !Textutils.isempty (Text.trim ()); intindex = Text.indexof (".")); intindex0 = Text.indexof ("0"); if(index0 = = 0 && text.substring (1). Equals ("0") {Mtext.settext ("0"); Mtext.setselection (1); } if(Index > 0) { if(Text.length () > Index + 3) {String Paytext= text.substring (0, Index + 3); Mtext.settext (Paytext); Mtext.setselection (Paytext.length ()); } } Else if(Index = = 0) {Mtext.settext (""); } if(!Textutils.isempty (Mtext.gettext (). toString ())) { floatf =float.parsefloat (Mtext.gettext (). toString ()); if(F >= 1.00) { if(F < 1000000.00) {Mclickbutton=true; Mmoney=Mtext.gettext (). toString (); Checksubmit (); } Else{mtext.settext (Mmoney); Mtext.setselection (Mmoney.length ()); Mclickbutton=false; Checksubmit (); } } Else{Mclickbutton=false; Checksubmit (); } } Else{Mclickbutton=false; Checksubmit (); } checksubmit (); } });
Enter price judgment in Android EditText