What's the best way to defer a query managed by a Loader?
<p>I am using the LoaderManager to handle a query that is backing a listview.  It relies on some parameters that aren't known until later in the process though.  Currently I call</p>

<pre><code>getSupportLoaderManager().initLoader(0, null, callback);
</code></pre>

<p>within onCreate().  This will immediately create the loader and execute the query, before the parameters are all known.  To handle that, I have a dummy query in onCreateLoader() when not all params are known, and a flag in my callback handler that checks within onLoadFinished() whether or not we have a legitimate query.  If it's not, I ignore the cursor data.  When it comes time to do a real query, I call</p>

<pre><code>getSupportLoaderManager().restartLoader(0, null, callback);
</code></pre>

<p>and also set my flag to true, so that onLoadFinshed() handles it properly.</p>

<p>What I'm doing above seems kind of hacky; is there a better way?  I originally tried to call initLoader() later, when I first need the query, but then things fail upon orientation changes, similar to <a href="http://stackoverflow.com/questions/7166363/loadercallbacks-onloadfinished-not-called-if-orientation-change-happens-during-a">this question</a>.</p>
