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

  • Home
  • SEARCH
  • 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 6657503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:46:34+00:00 2026-05-26T01:46:34+00:00

I have a task that takes about 10 seconds on the UI thread during

  • 0

I have a task that takes about 10 seconds on the UI thread during initialization of my app, I decided to instead put this in a background thread and show a splash screen while this was going on.. I got this working using AsyncTask… however because of AsyncTasks priority being hard coded so low, and no way to increase it that I can find, the task went from taking 10 seconds to finish, to several minutes.

So, the question I have is, how do I run a task on a NON UI thread without AsyncTask? Everything I have tried to so far seems to run on the UI Task which prevents the SplashScreen from appearing until after the task is done.

So how do I create a thread, run it on a non UI thread? I assume there must be an option other than AsyncTask but so far I have not found it… handlers just seem to run on the UI, as do standard threads/runnables. This has to be possible, but I am just not figuring it out.

  • 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-05-26T01:46:35+00:00Added an answer on May 26, 2026 at 1:46 am

    Since you already got the AsyncTask working, maybe you could just bump it’s priority from inside doInBackground():

    protected Void doInBackground() {
        Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
        /* do the work */
    }
    

    Also, for the Handler, not exactly sure what the problem was, but you need to create the Handler in the UI thread, explicitly start a different thread to do your work, then use the handler from that new thread to post messages to the UI thread. AsyncTask is nice because it takes care of all this for you.

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

Sidebar

Related Questions

I have a backroundrb scheduled task that takes quite a long time to run.
So we have a winforms app that in the task manager should anywhere from
I have a Task object that has a collection of Label objects ... in
I have a Rakefile with a Rake task that I would normally call from
I have an update query being run by a cron task that's timing out.
I have an Ant script that performs a copy operation using the 'copy' task
I have a Samurize config that shows a CPU usage graph similar to Task
I have this Task model: class Task < ActiveRecord::Base acts_as_tree :order => 'sort_order' end
I am trying to spawn a thread to take care of DoWork task that
I have some problem with CompletionService. My task: to parse parallely for about 300

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.