Blocking i/o operations can't happen on the UI thread.  Any DB query needs to be started from within a thread in a service.