This is an infamous Java pitfall. Use String.equals() instead.
Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 11, 5:52 am, "[email protected]" <[email protected]> wrote: > I am writing a simple check of values held by two string variables, > these two variables are created by returning a string from a method > that checks a remote database on the internet, and the other is a > string value taken from strings.xml > > stringa = text.getText().toString().toUpperCase(); > temp = FetchDBInfo(stringa); //returns a string, on no dbinfo returns > 'Empty' > String empty = getString(R.string.empty); // R.string.empty is the > string 'Empty' > if (temp == empty) { > temp = "No information available for " + stringa; > > } else { > > // Do other stuff > > } > > Even by outputting the values of temp and empty which are identical, > (created the return to be the same), in the DDMS and are both string > variables or eclipse would highlight an error about comparing > different variable types, the program all ways goes to the else part!! > > I have wasted two hours on this, what am I missing!! > > With thanks > > Jacko --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

