On Tue, Jul 20, 2010 at 7:14 AM, Alok Kulkarni <kulsu...@gmail.com> wrote:
> I have a background thread which queries for 1000 records at a time. After
> querying , when i call cursor.moveToFirst(), the UI gets blocked until the
> operation is completed.

When you call query() or rawQuery(), the query is not actually
performed until you first try to access the data via the Cursor, such
as moveToFirst().

> I use Thread.sleep in between
> after each 1000 records

Why?

> As soon as cursor.moveToFirst is called, UI blocks
> for 2 3 seconds.
> Am i missing anything here ?

Do your query and moveToFirst() call in an AsyncTask, or otherwise get
that work off of the main application thread.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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

Reply via email to