android - My activity doesnt recognise text equality -
can me, i'm killing myself on here. in activity have code , application displays currentq not equal (currentq.getodg() != answer.gettext())
answer can see through logcat log.d words identical. can't understand doing wrong.
08-25 05:28:45.125: d/yourans(25316): na život u mraku na život u mraku log cat
radiogroup grp = (radiogroup) findviewbyid(r.id.radiogroup1); answer = (radiobutton) findviewbyid(grp.getcheckedradiobuttonid()); log.d("yourans", currentq.getodg() + " " + answer.gettext()); if (currentq.getodg().equals(answer.gettext())) { answer.setbackgroundresource(r.drawable.radiotocan); toast poruka1 = toast.maketext(getapplicationcontext(), "točno!", toast.length_long); view vieew1 = poruka1.getview(); // vieew.setbackgroundcolor(color.parsecolor("#bd8bdc")); vieew1.setbackgroundresource(r.drawable.toast1); poruka1.setview(vieew1); poruka1.setgravity(gravity.center_horizontal, 1, 1); poruka1.show(); score1++; log.d("score1", "your score" + score1); new handler().postdelayed(new runnable() { @override public void run() { answer.setbackgroundresource(r.drawable.radiomain); } }, 300); } else if (currentq.getodg() != answer.gettext()) { answer.setbackgroundresource(r.drawable.radionetocan); toast poruka2 = toast.maketext(getapplicationcontext(), "netočno, točan odgovor je:" + currentq.getodg(), toast.length_long); view vieew2 = poruka2.getview(); // vieew.setbackgroundcolor(color.parsecolor("#bd8bdc")); vieew2.setbackgroundresource(r.drawable.toast); poruka2.setview(vieew2); poruka2.setgravity(gravity.center_horizontal, 1, 1); poruka2.show(); new handler().postdelayed(new runnable() { @override public void run() { answer.setbackgroundresource(r.drawable.radiomain); } }, 300); }
try
if(currentq.getodg().equalsignorecase(answer.gettext()))
instead of
if(currentq.getodg()!=answer.gettext())
hope helps!
Comments
Post a Comment