diff --git a/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java b/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java index 387b2b4..27a5674 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java @@ -49,6 +49,9 @@ public class MainActivity extends Activity { // We're back on the main thread at this point, so it's legal. ((TextView)findViewById(R.id.txtNoLocations)).setVisibility(View.GONE); ((ListView)findViewById(R.id.listLocations)).setVisibility(View.VISIBLE); + + // And we're even kind enough to update the database + LocationDatabaseHelper.getInstance(MainActivity.this).persistAll(result); } }.execute(); } diff --git a/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java b/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java index 2c8883d..a253cf8 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java @@ -3,13 +3,11 @@ package edu.uncc.scavenger.rest; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutionException; -import edu.uncc.scavenger.R; -import edu.uncc.scavenger.database.LocationDatabaseHelper; +import retrofit.RestAdapter; import android.content.Context; import android.os.AsyncTask; -import retrofit.RestAdapter; +import edu.uncc.scavenger.R; public class LocationClient { @@ -30,7 +28,7 @@ public class LocationClient { public static class LocationsDownloader extends AsyncTask> { - Context ctx; + private Context ctx; public LocationsDownloader(Context ctx) { this.ctx = ctx; @@ -41,14 +39,4 @@ public class LocationClient { return getAdapter(ctx).listLocations(); } } - - public static AsyncTask> updateDatabase(Context ctx) { - // Start the downloader and wait until it's finished. - return new LocationsDownloader(ctx) { - @Override - protected void onPostExecute(List result) { - LocationDatabaseHelper.getInstance(ctx).persistAll(result); - } - }.execute(); - } }