Hi,
I'm having a bit of a problem with the return values from
preferences.getString. The value that I'm getting returned doesn't
seem to be correct.
This snippet will not evaluate correctly (i'm omitting the
toast.length_long ending since it formats squirrelly). This always
goes to the else (i.e. 'nothing') condition. There are only two
possible values ("Two" and "Four").
String strTemp=prefs.getString("listPlayers", "");
if (strTemp=="Two") {
Toast.makeText(WarGamePlay.this, "two?",
} else if (strTemp=="Four") {
Toast.makeText(WarGamePlay.this, "four?",
} else {
Toast.makeText(WarGamePlay.this, "nothing?",
}
If i exchange the prefs.getString with just...
String strTemp="Two";
then that correctly goes to the first condition in the if/else tree.
What am I missing? I have checked the values coming back from the
prefs.getString and there are no leading/trailing spaces or anything
else visually wrong that I can see with the value.
Any help on this would be appreciated. Thanks in advance.
Erik Wagner
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en