private ListAdapter createPlaceListAdapter(final List<PlaceInfo> placesRetrieved){
  final double kilometersInAMile=1.60934;
  List<Map<String,Object>> data=new ArrayList<>();
  for (  PlaceInfo place : placesRetrieved) {
    Map<String,Object> map=new HashMap<>();
    map.put("placeIcon",R.drawable.ic_shopping_cart_black_48dp);
    map.put("placeName",place.getName());
    map.put("placeAddress",place.getAddress());
    String distance=String.format(getString(R.string.distance),place.getDistanceInKilometers(),place.getDistanceInKilometers() / kilometersInAMile);
    map.put("placeDistance",distance);
    data.add(map);
  }
  return new SimpleAdapter(MainActivity.this,data,R.layout.place_item,new String[]{"placeIcon","placeName","placeAddress","placeDistance"},new int[]{R.id.place_Icon,R.id.place_name,R.id.place_address,R.id.place_distance});
}

private ListAdapter createPlaceListAdapter ( final List < PlaceInfo > placesRetrieved ) { final double kilometersInAMile = 1.60934 ; List < Map < String , Object > > data = new ArrayList < > ( ) ; for ( PlaceInfo place : placesRetrieved ) { Map < String , Object > map = new HashMap < > ( ) ; map . put ( "placeIcon" , R . drawable . ic_shopping_cart_black_48dp ) ; map . put ( "placeName" , place . getName ( ) ) ; map . put ( "placeAddress" , place . getAddress ( ) ) ; String distance = String . format ( getString ( R . string . distance ) , place . getDistanceInKilometers ( ) , place . getDistanceInKilometers ( ) / kilometersInAMile ) ; map . put ( "placeDistance" , distance ) ; data . add ( map ) ; } return new SimpleAdapter ( MainActivity . this , data , R . layout . place_item , new String [ ] { "placeIcon" , "placeName" , "placeAddress" , "placeDistance" } , new int [ ] { R . id . place_Icon , R . id . place_name , R . id . place_address , R . id . place_distance } ) ; }
creates listadapter populated with the list of nearby places .
