Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8235673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:53:16+00:00 2026-06-07T18:53:16+00:00

I am using AsyncQueryHandler and it calls onQueryComplete once the query is complete. My

  • 0

I am using AsyncQueryHandler and it calls onQueryComplete once the query is complete.

My question: is onQueryComplete called on the UI thread?

I know it does the query in the background.

Does it matter where AsyncQueryHandler is instantiated? (If instantiated in UI thread will mean onQueryComplete will be called on UI thread).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:53:18+00:00Added an answer on June 7, 2026 at 6:53 pm

    Is onQueryComplete called on UI thread?

    It’s called on the calling thread… so the thread on which you launched the AsyncQueryHandler.

    Does it matter where AsyncQueryHandler is instantiated?

    AsyncQueryHandler is a subclass of Handler that performs an asynchronous query (or insert, update, delete) to the ContentResolver and returns the result to the calling thread. Handlers are allowed to be associated with threads other than the main UI thread, and so are queries/transactions to the ContentResolver. Therefore, you should be allowed to call AsyncQueryHandler from a separate thread too.

    That being said, doing so is probably not what you want for a couple reasons:

    1. When you instantiate the AsyncQueryHandler on a separate thread, all subsequent callbacks will be returned to that calling thread. This is usually not what you want because it doesn’t provide an easy means of syncing with the main UI thread, the thread that is responsible for creating your layouts and receiving your touch events.

    2. You are already on a separate thread, so calls to the ContentResolver will already be asynchronous with respect to the UI thread.

    And by the way, the documentation on AsyncQueryHandler doesn’t mention anything about these points, but you can figure most of it out by reading the source code. The documentation for Handler (its immediate base class) explains the theory behind it too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using NSDateComponents I know how to get the day component, but this gives me
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using C#, I need a class called User that has a username, password, active
Using Codeigniter (v1.7.2) Active Record Class to query a MSSQL Database (external DB, I
Using the following query: SELECT sum(severity) as Score, DATE_FORMAT(LAST_UPDATE,%Y-%m) as score_date FROM missingpatches GROUP
using the jquery ui modal dialog , the background shades grey (i assuming this
Using Browserlab, it appears that the background image is not centred in Firefox7 for
Using SQL Alchemy, I'd like to know if it's possible to get a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.