Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>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.</p> </blockquote> <p>As per the doc <a href="http://developer.android.com/training/displaying-bitmaps/process-bitmap.html" rel="nofollow">here</a>,</p> <blockquote> <p>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).</p> </blockquote> <p>So you can use a seperate thread to load resources on above mentioned conditions.</p> <p>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.</p> <p>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 <a href="http://android-developers.blogspot.in/2009/02/track-memory-allocations.html" rel="nofollow">link</a> to get to know about using tracking memory allocations and how to avoid frequent garbage collection to happen.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload