You cannot use == for comparing strings. You have to use the equals method:
if (queryString.equals("text")) //do stuff ---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ---------------------------------------------------------------------- On Fri, Jun 18, 2010 at 9:57 AM, Tollas <tolla...@gmail.com> wrote: > I am retrieving data from a SQL query. The data retrieves fine. If I > place the data in a TextView field, I see the text. > When I try to compare it in an "IF" statement, however, the statement > sees the data as false, even if it should be true. > If I set the variable to a good value (not getting data from the SQL > query) the IF statement works fine. > > Example > > String queryString = c.getString(c.getColumnIndex("table_query")); > > if (queryString == "text"){ > // do this > } > > > I have checked my data. If I query the database for table_query = > 'text' I receive results. > This is happening for 5 different fields where a comparison is made, > each with a different variable and if statement. > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en