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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:32:50+00:00 2026-06-17T18:32:50+00:00

I asked a lead in to this question here . I want to know

  • 0

I asked a lead in to this question here. I want to know if it is recommended to read the android resources (in the res) folder on the ui-thread or on the game thread for a simple game (based off the lunar lander sample). I see in lunar lander that they allocate resources before starting the game loop. However that doesn’t scale up very well if there are lots of resources. The answer to my previous question says that it is ok to read resources like bitmaps on the background thread. Now I want to know if this is the correct way to do things.

An alternate architecture would be to post a Runnable to the ui-thread from time to time and allocate resources then.

Does garbage collection come into play? I wasn’t sure which thread GC runs on. But my guess is that it runs on the thread on which the object was allocated.

  • 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-17T18:32:52+00:00Added an answer on June 17, 2026 at 6:32 pm

    The answer to my previous question says that it is ok to read
    resources like bitmaps on the background thread. Now I want to know if
    this is the correct way to do things.

    As per the doc here,

    The BitmapFactory.decode* methods, discussed in the Load Large Bitmaps
    Efficiently lesson, should not be executed on the main UI thread if
    the source data is read from disk or a network location (or really any
    source other than memory). The time this data takes to load is
    unpredictable and depends on a variety of factors (speed of reading
    from disk or network, size of image, power of CPU, etc.). If one of
    these tasks blocks the UI thread, the system flags your application as
    non-responsive and the user has the option of closing it (see
    Designing for Responsiveness for more information).

    So you can use a seperate thread to load resources on above mentioned conditions.

    I think it depends on your needs and the size and number of resource and even if there are some other things to consider. For an instance, if you don’t want your app user to navigate to the next screen until all your resources are loaded then using a thread may be helpful.

    Garbage collection works in daemon thread. The daemon thread runs in the background.
    Garbage collection comes into action when object becomes eligible for garbage collection i.e, when there are no live reference available or when memory becomes too low. Use this link to get to know about using tracking memory allocations and how to avoid frequent garbage collection to happen.

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

Sidebar

Related Questions

I don't know if this question was already asked, but I could not find
Surprised this question has not been asked yet here, but here goes: Serialization in
I just asked this question . Which lead me to a new question :)
I know this question may be a little bit common and over asked but
I asked this question earlier and I got very quick and helpful responses: Linq
I asked a question before about VerticalRulers , with this hint I added a
I asked a very similar question here but since it is such a fundamental
I asked this question over Security site, and people there suggested I should have
I asked this question earlier: How to get delta between two text items But
I asked this question earlier, and after thinking about the topic some more, I

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.