java - Having issues with Handler in Android -
i creating handler
reason if statement
not trigger
. log printing out correct value right before if statement
.
mhandler = new handler() { @override public void handlemessage(message msg) { string s=(string)msg.obj; s = s.trim(); log.v("mhandler reply", s); if(s == "ok"){ dialog.dismiss(); } }
};
here log
03-24 09:02:53.707: v/mhandler reply(7331): ok
why not working?
use equals()
method instead of ==
operator string
comparison follows...
if(s.equals("ok")){ dialog.dismiss(); }
to more information check how compare strings in java?
Comments
Post a Comment