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 getReadableDatabase for the 30000 songs list query.. UI does not block now..Yippee I am sorry for the incorrect inference that i got earlier .. Thanks And Regards, Alok.
On Tue, Jul 20, 2010 at 6:52 PM, Alok Kulkarni <kulsu...@gmail.com> wrote: > 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 as DB was created > in UI context. > > > > > On Tue, Jul 20, 2010 at 6:01 PM, Mark Murphy <mmur...@commonsware.com>wrote: > >> On Tue, Jul 20, 2010 at 8:24 AM, Alok Kulkarni <kulsu...@gmail.com> >> 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.moveToFirst(); >> > Log.i("VALUE----->", "After movetoFirst" + >> System.currentTimeMillis()); >> > >> > Output :- >> > Before movetoFirst 1279628503040 >> > After movetoFirst 1279628508063 >> > This clearly shows a difference of 5 seconds.(My emulator is slow.On >> device >> > it takes 2 to 3 seconds) >> >> That is to be expected given your query. However, according to you, >> that is in a background thread. And, according to you, your problem is >> the UI being blocked. >> >> -- >> 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<android-developers%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- 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