Android Open Source - unicef_gis_mobile Report Loader

From Project

Back to project page unicef_gis_mobile.


The source code is released under:

MIT License

If you think the Android project unicef_gis_mobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.unicef.gis.model.couchdb;
/*w w w  .  j a  va 2s .co m*/
import java.util.List;

import org.unicef.gis.model.Report;

import android.content.AsyncTaskLoader;
import android.content.Context;

public class ReportLoader extends AsyncTaskLoader<List<Report>> {
  private List<Report> reports = null;
  public ReportLoader(Context context) {

  public List<Report> loadInBackground() {
    UnicefGisStore store = new UnicefGisStore(getContext());    
    return store.getReports();
  public void deliverResult(List<Report> data) {
      // Hold a reference to the old data so it doesn't get garbage collected.
      // We must protect it until the new data has been delivered.
    List<Report> oldReports = reports;
    reports = data;
    if (isStarted()) super.deliverResult(reports);

  protected void onStartLoading() {
    if (reports != null) deliverResult(reports);
    else forceLoad();
  protected void onStopLoading() {
  protected void onReset() {
    reports = null;
  public void onCanceled(List<Report> data) {

Java Source Code List