package com.example.android.quakereport;

import android.content.AsyncTaskLoader;
import android.content.Context;
import android.util.Log;
import java.util.List;

/**
 * Created by Lenovo on 7/6/2017.
 */

public class EarthquakeLoader extends AsyncTaskLoader<List<Earthquake>>
{
    final static String LOG_TAG = EarthquakeLoader.class.getSimpleName();
    private String mUrl;

    //TODO: Extract the earthquake data from the USGS url

    public EarthquakeLoader(Context context, String url)
    {
        super(context);
        this.mUrl = url;
    }

    @Override
    protected void onStartLoading()
    {
        forceLoad();
    }

    @Override
    public List<Earthquake> loadInBackground()
    {
        List<Earthquake> result = null;

        // Don't perform the request if there are no URLs, or the first URL
        if(getUrl().length() < 1)
            return null;
        try
        {
            // Perform the HTTP request for earthquake data and process the response.
            result = QueryUtils.fetchEarthquakeData(getUrl());

        }catch (SecurityException e)
        {
            Log.e(LOG_TAG, e.getMessage(), e);
        }
        return result;
    }

    //@return the url of the earthquake data to the displayed
    public String getUrl()
    {
        return mUrl;
    }
}

@@ -199,16 +199,146 @@
 7.%0A */%0A%0A
+/*%0A   Loads a list of earthquakes by using an AsyncTaskLoader to perform the%0A   network request to the destination(USGS) url.%0A */%0A
 public c
@@ -407,16 +407,55 @@
 %3E%0A%7B%0A    
+/* Tag for log messages */%0A    private 
 final st
@@ -515,16 +515,37 @@
 eName();
+%0A%0A    /* Query URL */
 %0A    pri
@@ -817,32 +817,104 @@
 eLoad();%0A    %7D%0A%0A
+    /*%0A     * Run the earthquake data request in the background%0A     */%0A
     @Override%0A  
@@ -989,22 +989,27 @@
 hquake%3E 
-result
+earthquakes
  = null;
@@ -1101,29 +1101,20 @@
  if(
-getUrl().length() %3C 1
+mUrl == null
 )%0A  
@@ -1171,17 +1171,17 @@
        /
-/
+*
  Perform
@@ -1243,16 +1243,19 @@
 esponse.
+ */
 %0A       
@@ -1259,22 +1259,27 @@
         
-result
+earthquakes
  = Query
@@ -1304,24 +1304,20 @@
 akeData(
-get
+m
 Url
-()
 );%0A%0A    
@@ -1435,137 +1435,19 @@
 urn 
-result;%0A    %7D%0A%0A    //@return the url of the earthquake data to the displayed%0A    public String getUrl()%0A    %7B%0A        return mUrl
+earthquakes
 ;%0A  

Replace AsyncTask with AsyncTaskLoader and do some clean up.