caipivara
5/10/2015 - 3:05 PM

Android - https://github.com/pushbit/sprockets-android - Load prediction data on place click (this case name, formatted address and latlng

Android - https://github.com/pushbit/sprockets-android - Load prediction data on place click (this case name, formatted address and latlng

@Override public void onPlaceClick(AdapterView<?> adapterView, Place.Prediction prediction, int i) {
	new AsyncTask<Place.Prediction, Void, Void>() {
	    @Override protected Void doInBackground(Place.Prediction... params) {
	        Places.Params param = new Places.Params().placeId(params[0].getPlaceId().getId());
	        Places.Field[] fields = {Places.Field.NAME, Places.Field.FORMATTED_ADDRESS,
	                Places.Field.GEOMETRY};
	        Place placeDetail = null;
	        try {
	            placeDetail = Places.details(param, fields).getResult();
	        } catch (IOException e) {
	            Timber.e(e, "Error getting address details");
	        }
	
	        return null;
	    }
	}.execute(prediction);
}