Note that there are some explanatory texts on larger screens.

plurals
  1. POSometimes don't get onCreateLoader callback after calling initLoader
    text
    copied!<p>I have an activity that calls initLoader when it is created in order to load the data that the activity will display. Normally, this works fine. I have breakpoints set to see the order that everything happens. First I call initLoader, then I get the OnCreateLoader callback, then the OnLoadFinished callback, then everything is great.</p> <p>However, I noticed that if I changed the orientation on my Android that I don't get the OnCreateLoader callback or the OnLoadFinished callback, resulting in no data displayed on the page. I still get my breakpoint on the initLoader call so I know that is happening, but I don't get an error and I can't find any documentation explaining why I wouldn't get a callback after calling initLoader.</p> <p>Interestingly, I do get the callbacks if I return to the original orientation. </p> <p>So, to summarize:</p> <p>I start the activity in portrait orientation</p> <ul> <li>I call initLoader</li> <li>I get onCreateLoader and onLoadFinished callbacks</li> </ul> <p>I then change to landscape</p> <ul> <li>I call initLoader</li> <li>no onCreateLoader or onLoadFinished callbacks</li> </ul> <p>I change back to portrait</p> <ul> <li>I call initLoader</li> <li>I get onCreateLoader and onLoadFinished callbacks</li> </ul> <p>Similarly, if I start the activity in landscape mode I get the callbacks. Then, if I switch to portrait, I don't. Then, if I switch back to landscape I get the callbacks again.</p> <p>Does anyone have any idea what's going on?</p>
 

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