mirror of
https://github.com/bspeice/itcs4180
synced 2025-04-20 23:01:34 -04:00
Successfully contact the server
This commit is contained in:
parent
9219578b84
commit
22d8236bf6
@ -7,6 +7,7 @@
|
|||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="11"
|
android:minSdkVersion="11"
|
||||||
android:targetSdkVersion="19" />
|
android:targetSdkVersion="19" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
BIN
UNCCScavenger/libs/gson-2.2.4.jar
Normal file
BIN
UNCCScavenger/libs/gson-2.2.4.jar
Normal file
Binary file not shown.
@ -3,9 +3,11 @@ package edu.uncc.scavenger.rest;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import edu.uncc.scavenger.R;
|
import edu.uncc.scavenger.R;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
import retrofit.RestAdapter;
|
import retrofit.RestAdapter;
|
||||||
|
|
||||||
@ -32,6 +34,23 @@ public class LocationClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Location> getLocations() {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user