[android-developers] Re: Comparing two strings get false

2010-06-29 Thread String
Or this: if (string1.equals(string2)) { ... } String ;^) On Jun 29, 8:18 pm, Brad Gies rbg...@gmail.com wrote: use String1.compareTo(String2) == 0 On 29/06/2010 1:53 AM, Martin wrote: Hi, I have a strange error that I can't understand.  I have this code: if (VersionsKoll

Re: [android-developers] Re: Comparing two strings get false

2010-06-29 Thread Frank Weiss
Further clarification: in Java the == operator works differently for primitive types (int, double, etc.) than for Objects (such as String). -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to

[android-developers] Re: Comparing two strings get false

2010-06-29 Thread Streets Of Boston
Actually, it works the same for both Objects and primitive types. The == operator checks if the value held by both variables is the same. For primitive types (e.g. int), this value is a 32-bit value (or 64- bit for long, etc). For Objects, this value is the *reference* to an object, not the