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 6864307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:53:42+00:00 2026-05-27T02:53:42+00:00

Short verson Is it allowed, or do I need to use the UI thread?

  • 0

Short verson

Is it allowed, or do I need to use the UI thread?

EDIT: A reference to a place in the official android docs would be ideal.

Long version

Android docs make it clear that it’s not allowed to “access the Android UI toolkit from outside the UI thread”.

On the other hand, creating Bitmap objects from worker threads seems to be allowed, at least it’s being done in sample code:
http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html
Apparently, the Bitmap class is not considered part of the “UI toolkit” as far as threading is concerned.

I’ve got a piece of code that seems to work when invoked from a non-ui thread. It involves using Bitmap.createBitmap(int,int,Bitmap.Config), new Canvas(bitmap), Typeface.create() and text drawing. My code does not refer to any View object.

Can someone point me to a piece of documentation that says that I may do these things from a background thread? Or will doing this lead to random crashes?

  • 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-27T02:53:43+00:00Added an answer on May 27, 2026 at 2:53 am

    UI toolkit means UIs such as buttons, labels, listview, and so on provided by Google. You can’t access them from non-ui thread mainly because they are not thread-safe.

    What you are doing is not on UI toolkit but on low-level Canvas which is allowed (actually should be allowed) to access from non-ui threads. This mechanism is used in game development all the time. So I believe you are safe.

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

Sidebar

Related Questions

Short version Need to distribute nightly builds to 70+ people each morning, would like
Short Version Are class variables thread-safe for the duration of a controller action? Long
Short version: assuming I don't want to keep the data for long, how do
Short version: For a cache class I need to get notified if an object
Short Version Calls to CommandManager.InvalidateRequerySuggested() take far longer to take effect than I would
Short version: What kind of escape sequence can one use to search for unicode
Short version: How do I create the <> column manually? Long version: In Access
Short version I would like to scroll the ListBox item into view when the
Short version: I'm trying to figure out how to use the dsn argument in
Short version: When I try to use Access's DatePart function via ODBC, it cannot

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.