mirror of
				https://github.com/bspeice/itcs4180
				synced 2025-11-03 18:00:37 -05:00 
			
		
		
		
	Successfully contact the server
This commit is contained in:
		@ -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;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user