java - String !equals of edittext not working -
with of cursor c , c1 ,i checking 2 database edittext.if not equal,then move notfound activity.
below posted code:
if (c.getcount() > 0) { ..... .... } else if(c1.getcount()>-1){ .... .... } else{ if(!(edittext.gettext().tostring()).equals("c") && (!(edittext.gettext().tostring().equals("c1")))) { ---->not working intent i2=new intent(plate.this,notfound.class); startactivity(i2); } } my problem if(!(edittext.gettext().tostring()).equals("c") && (!(edittext.gettext().tostring().equals("c1")))) not working.i not sure what's wrong in that.
the expression in if statement seems little muddled there parentheses in statement changes how works:
!(edittext.gettext().tostring()).equals("c") && (!(edittext.gettext().tostring().equals("c1"))) if simplify it, calling first expression edittext.gettext().tostring() new variable a (notice lack of equals()) , second part edittext.gettext().tostring().equals("c1") new variable b, left ((!a).equals("c") && !b) doesn't make sense.
i believe want replace a edittext.gettext().tostring().equals("c") , use !a && !b instead,
(!edittext.gettext().tostring().equals("c") && !edittext.gettext().tostring().equals("c1")) that statement return true when edittext not contain "c" or "c1".
Comments
Post a Comment