Successfully contact the server

master
DjBushido 2014-04-05 17:25:04 -04:00
parent 9219578b84
commit 22d8236bf6
3 changed files with 22 additions and 2 deletions

View File

@ -6,7 +6,8 @@
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"

Binary file not shown.

View File

@ -3,9 +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 android.content.Context;
import android.os.AsyncTask;
import retrofit.RestAdapter;
@ -32,6 +34,23 @@ public class LocationClient {
}
public List<Location> getLocations() {
return getAdapter().listLocations();
try {
// Inline AsyncTask
return new AsyncTask<Void, Void, List<Location>>() {
@Override
protected List<Location> doInBackground(Void... params) {
// Work happens here
return getAdapter().listLocations();
}
}.get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}