Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8962971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:15:24+00:00 2026-06-15T16:15:24+00:00

In my Android app, I am making a http request, getting some data, putting

  • 0

In my Android app, I am making a http request, getting some data, putting it in my local sqlite database & then populating a gridview using that data. I have the code working for an activity but I need to use fragment now to get this done as there are many similar pages to be shown. I read that using Loader is the best way to deal with data in a fragment.

I am not sure about:

  1. Whether to use CursorLoader, Async taskLoader or SQLiteLoader(developed by commons guy).
  2. In which of the loader functions (onCreateLoader(), onLoadFinished() etc.) do I put my code for making http request, populating the local database & getting the data displayed in a gridview in my fragment
  3. I am also using a lazyload list to show images. How will that fit into the entire thing if I use loader

Can anybody help me with this one? Tried searching for good examples or tutorials but I haven’t really found something that’s really useful. So, please suggest any if you can. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:15:25+00:00Added an answer on June 15, 2026 at 4:15 pm

    Whether to use CursorLoader, Async taskLoader or
    SQLiteLoader(developed by commons guy).

    CursorLoader is for ContentProviders(which is not your case) and AsyncTaskLoader 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.

    In which of the loader functions (onCreateLoader(), onLoadFinished()
    etc.) do I put my code for making http request, populating the local
    database & getting the data displayed in a gridview in my fragment

    In none of those callbacks because they run(most likely) on the main UI and you must not do network operations in there. The Loader subclasses have the loadInBackground method which runs on a background thread. On this method the Loader queries for data and in which you could place your networks requests and database updating. But you would need to be very careful to not insert duplicate data in the database.

    I am also using a lazyload list to show images. How will that fit into
    the entire thing if I use loader

    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 GridView‘s adapter.

    My advice is to not use Loaders for loading and 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 AsyncTaskLoader(or use Commonsware’s library) which queries the database for new data. I would then start a new AsyncTask to do the http request and to insert data in the database and then I would trigger a Loader restart in the onPostExecute method of the AsyncTask(with getLoaderManager().restartLoader...). Have a look at this similar question for some problems related to what you’re trying to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an android app for http://yearbook08.com/ I know how to parse through
I'm making a new Android app that essentially mirrors data available on our website.
Scenario: Making an Android app using data from a website built with Wordpress. The
Having done some basic tutorials, I started making my first real android app in
Hello I am in the process of making an Android app that pulls some
Having done some basic tutorials, I started making my first real android app in
I am making an android app. I have a main activity and i want
I'm making an android app, and I need to save the double value(BodySize) to
I am making an android app in which i am trying to slide between
I'm making a Android app that basically plays video from a website on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.