Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Alok Kulkarni
Problem Solved.. The problem was that i was querying on the tracks database for 1000 songs.. At the same time, scrolling the list would make a call to the same tracks table. This is synchronous in Android using the same DB object. So the solution was to create a seperate DB object as getReadableDat

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Alok Kulkarni
Yess :( Anyone can try it out.. One more thing.. I have iniialised the DB ie called the getWritiabledDatabase at the start of app from the Application class.Is the accessing the DB from a new thread causing the UI to hang if supposedly the Application context means the UI context getting blocked a

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Mark Murphy
On Tue, Jul 20, 2010 at 8:24 AM, Alok Kulkarni wrote: > Thanks for your reply. What i did was i removed the System.gc() as well as > the handler call. > Considering the codeĀ  from above snippet. > > Log.i("VALUE->", "Before movetoFirst" + > System.currentTimeMillis()); > mCursor.move

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Alok Kulkarni
; > > } catch (Exception e) { > > // TODO Auto-generated catch block > > e.printStackTrace(); > > } > > > > > > } > > } > > } > > > > If i don

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Mark Murphy
If i dont do a Thread.sleep... the UI gets completely blocked until all the > records are fetched.\ > To update the UI i am calling a handler. > Thanks , > Alok. > > On Tue, Jul 20, 2010 at 5:10 PM, anil kukreti > wrote: >> >> Ya Mark is right ! >> >>

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Alok Kulkarni
nil kukreti wrote: > > Ya Mark is right ! > > You need to use *multithreading* for making a reponsive UI. > > Thread.sleep inside spawned thread will give a chance to main UI thread to > response to User events. > > > -- Forwarded message -- > From: Alok

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread anil kukreti
-developers] cursor.moveToFirst() blocking UI To: android-developers@googlegroups.com Hi, 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.This is very disturbing experience

Re: [android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Mark Murphy
On Tue, Jul 20, 2010 at 7:14 AM, Alok Kulkarni 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

[android-developers] cursor.moveToFirst() blocking UI

2010-07-20 Thread Alok Kulkarni
Hi, 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.This is very disturbing experience for user , especially if there are 1 plus records.I use Thread.sleep in between aft