java - EditText equals -
i have search app has 150 files. if searches 151, "the file 151 can't found".
i have code:
edittext edit = (edittext) findviewbyid(r.id.edittext1); if (edit.gettext().tostring().equals("151")) { edit.seterror("invalid file name"); } else { // nothing; }
but have 2 questions:
- how can set
.equals("151")
like:.equals("151" >)
(151 , up)? - what code of: "do nothing"?
you create int string. this:
int aint = integer.parseint(edit.gettext().tostring()); if(aint > 150) dostuff();
to nothing, add ";".
if(foo) dostuff(); else ;
Comments
Post a Comment