Hi,

Currently i'm working on a database system for some applications. I
need to do a lot of queries to load data from the database into the
application. After being amazed how much time it took to do these
queries on the database i found out that much time was consumed by
cursor.MoveToFirst(). This functions costs currently ~25% of all my
database action.

Does anyone know why this takes would take so long or does anyone know
a better solution to get to the first position of the cursor?


My code:

Cursor c = db.query(var1, var2, var3 .....);
c.CustomMoveToFirst();

int count = c.getCount();
for(int i = 0; i<count; i++){
        doSomethingWithCursor();
        c.moveToNext();
}


The same problem occurs when i place everything in a while loop and
use only the MoveToNext() function. So i think that the problem must
be in positioning the cursor to the first position.

My code:
Cursor c = db.query(var1, var2, var3 .....);
c.CustomMoveToFirst();

while(c.moveToNext()){
         doSomethingWithCursor();
}

Thanks,
Sublimity Mobile Software

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to