Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Whether to use CursorLoader, Async taskLoader or SQLiteLoader(developed by commons guy).</p> </blockquote> <p><code>CursorLoader</code> is for <code>ContentProviders</code>(which is not your case) and <code>AsyncTaskLoader</code> is the way to go. I haven't use the classes from Commonsware but if they allow overriding of some of their methods then I guess you can use it.</p> <blockquote> <p>In which of the loader functions (onCreateLoader(), onLoadFinished() etc.) do I put my code for making http request, populating the local database &amp; getting the data displayed in a gridview in my fragment</p> </blockquote> <p>In none of those callbacks because they run(most likely) on the main UI and you must not do network operations in there. The <code>Loader</code> subclasses have the <code>loadInBackground</code> method which runs on a background thread. On this method the <code>Loader</code> queries for data and in which you could place your networks requests and database updating. But you would need to be <em>very careful</em> to not insert duplicate data in the database.</p> <blockquote> <p>I am also using a lazyload list to show images. How will that fit into the entire thing if I use loader</p> </blockquote> <p>As I haven't seen your code, I don't think this two parts are connected. I'm guessing that you use the lazy image loading code directly in the <code>GridView</code>'s adapter.</p> <p>My advice is to not use Loaders for loading <strong>and</strong> inserting data because their purpose is to only load data on a background thread(having taking care of configuration changes). For your particular situation I would make my own <code>AsyncTaskLoader</code>(or use Commonsware's library) which queries the database for new data. I would then start a new <code>AsyncTask</code> to do the http request and to insert data in the database and then I would trigger a <code>Loader</code> restart in the <code>onPostExecute</code> method of the <code>AsyncTask</code>(with <code>getLoaderManager().restartLoader...</code>). Have a look <a href="https://stackoverflow.com/questions/13571805/inserting-records-via-loaders-in-android/13572393#13572393">at this similar</a> question for some problems related to what you're trying to do.</p>
    singulars
    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