Always shows "else" statement. I don't know that's wrong here. please help.
The Android code:
public void setResult(final int val,final String cat){
if(cat=="home")
{
counter=0;
}
else if(cat=="featured")
{
counter=1;
}
else if(cat=="editorial")
{
counter=2;
}
else if(cat=="gallery")
{
counter=3;
}
else
{
Toast.makeText(parentActivity, "Invalid category: " + cat + "\n" + "cat.toString() is: " + cat.toString(), 5).show();
}
Toast.makeText(this.parentActivity, "Callback got val: " + val + "\n Category is: " + cat, 5).show();
}
The HTML code (within script tag):
function onload()
{
window.MyHandler.setResult(2,"featured");
}
The output here is:
Invalid category: featured
cat.toString() is: featured
Callback got val: 2
Category is: featured