Note that there are some explanatory texts on larger screens.

plurals
  1. POFragments, setRetainInstance(true), and threaded libraries
    primarykey
    data
    text
    <p><a href="https://review.source.android.com/#change,22355" rel="noreferrer" title="here">Here</a>, Dianne says that the old methods of retaining objects via <code>onRetainNonConfigurationInstance()</code> are now made obsolete by the fact that you can retain Fragment instances over configuration changes.</p> <p>And <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.html" rel="noreferrer" title="here">here</a>, in the API Demos for fragments, it shows how to use this method for maintaining threads after a configuration change.</p> <p>I see that during a configuration change, when the Fragment might not be attached to any activity and the thread is done doing it's work, it's able to call <code>wait()</code> so that it doesn't try to deliver results while an Activity isn't attached. I find this very useful, and a great way to mitigate one of the more pain-in-the-butt problems with Android orientation changes.</p> <p>However, if you're using a threaded library (an API library that uses a thread executor, for example), where you don't have access to <code>wait()</code> on said threads, how could we use this new feature to our advantage?</p> <p>How can we ensure that messages won't be delivered while an activity is not attached?</p> <p>I've been thinking of a way to maybe queue up messages and delivery them when a new Activity is attached, but I wanted to hit up you guys and see if you've already come up with some solutions.</p> <p>Also, note, I've looked into the LoaderManager API, and it seems like it would be good for data that needs to be loaded when an Activity is shown, but not for something event based, like logging in via a button, etc.</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.
 

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