Reputation: 1849
Code:
String my = c.getString(c.getColumnIndexOrThrow("ringtype"));
Log.e("my", my);
if(my=="default")
{
Log.e(tablename, "button marked not visable1");
}
else
{
Log.e(tablename, "button marked visable2");
}
LogCat:
07-28 02:10:57.396: ERROR/my(16204): default
07-28 02:10:57.404: ERROR/meds(16204): button marked visable2
I also tried Log.e("my", "!"+my+"!");
to see if there was a hidden white space that was throwing it off. but there is not. as far as I can tell the two are a match and I should get the message that the button is not visible.
so I must be missing something but I can't figure out what it is edit: thanks everyone, I'd accept all the answers as they make sense if I could.
Upvotes: 0
Views: 69
Reputation: 13501
"my" is different object and "default" is another one.. when you use "==" operator it compares the actual address/reference where as ".equals" compares the content.. so use .equals
Upvotes: 3