Re: [android-beginners] Re: Comparing data retrieved from SQL query
And just as safe method for avoiding NPE, its good practice to do the following... if(text.equals(queryString)) //do stuff On Fri, Jun 18, 2010 at 10:50 AM, Tollas tolla...@gmail.com wrote: Worked great! Thanks! On Jun 18, 11:12 am, Justin Anderson janderson@gmail.com wrote: 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.comandroid-beginners%2bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- Mahesh http://www.maheshdixit.com http://askmahesh.blogspot.com/ -- 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
[android-beginners] Database version is zero on initial install
I have released an app (World Time) with initial database. Now i want to update the app with a database upgrade. I have put in the upgrade code in OnUpgrade() and checking for the newVersion. But it was not being called in my local testing... So i put in the debug statement to get the database version and it is zero . Any idea why it is not being versioned ? Following is the code to copy the database from my Assets folder ... * InputStream myInput = myContext.getAssets().open(DB_NAME); // Path to the just created empty db String outFileName = DB_PATH + DB_NAME; //Open the empty db as the output stream OutputStream myOutput = new FileOutputStream(outFileName); //transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer))0){ myOutput.write(buffer, 0, length); } //Close the streams myOutput.flush(); myOutput.close(); myInput.close();** * -- Mahesh http://android.maheshdixit.com -- 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
Re: [android-beginners] stupid android question
Search for the Weather Widget from the Market. The free one shows only the weather and the donation one will give the one you see in HTC Sense UI On Sat, Apr 3, 2010 at 10:23 PM, Craig White white.n...@gmail.com wrote: I really like the retro clock/calendar/weather widget I see pictured on all of the HTC/Sense handsets but doesn't seem to be an option on my Motorola Droid. Does anyone know if there's a similar package for the Droid running 2.1? Craig -- 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.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe, reply using remove me as the subject. -- Mahesh http://www.maheshdixit.com http://askmahesh.blogspot.com/ -- 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