On Thu, Oct 13, 2011 at 1:47 AM, Studio LFP <studio....@gmail.com> wrote:
> If you aren't, try using transactions: > > dbHandle.beginTransaction(); > lReturn = dbHandle.insert( sTable, null, cvEntry ); // Update and delete > here also > dbHandle.setTransactionSuccessful(); > dbHandle.endTransaction(); > > If you do multiple inserts/updates/deletes where you target specific rows > for a reason you can't include them all in one query, add more statements > between the beginTransaction and the setTransactionSuccessful. > Thanks Steven, I have implemented transactions and it runs about twice as fast but still have to wait a somewhat smaller fraction of a second. As to the connection it's only opened once and shared across intents. The queries are based on primary keys so I do not see the need to have separate indices. I think what is slowing things down could be the fact that I am reading every single row of every single table just to be on the safe side although things could be done more efficiently but at the risk of complicating the code and introducing bugs in the code. As to implementing the database calls in a separate thread, the reason I didn't do it is that the calling activity needs to display the data from the popped activity retrieving it from the database to make sure it's data remains consistent with the database. But it's true, I could store the data in the database in a separate thread and only read it when the application starts, and just write to it asynchronously. This would really make my app faster. Or I could display a progress bar in between operations. I just want to ensure my objects are always in sync with my database so I have a soreAndRetrieve() data method to make sure this happens at the expense of speed, so maybe it's my own problem. Thank you for all your replies, Regards, John Goche -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en