I am fairly new to app development, specifically Android. I have a CSV file with each line containing a pair of lat's and long's and a name for the POI. With my code below, after much reading and examining sample codes, I have successfully plotted the points on the map. However, I do not know how to add the title (name of POI) portion for the marker options section. My code below does not add the title on each POI. Any assistance will be highly appreciated:
Each line of the CSV file looks like this : PlaceName,-29.231,130.342.
InputStreamReader is = new InputStreamReader(getAssets().open("test.csv"));
BufferedReader reader = new BufferedReader(is);
List<LatLng> latLngList = new ArrayList<LatLng>();
List<String> siteList = new ArrayList<String>();
String info = "";
while ((info = reader.readLine()) != null) {
String[] line = info.split(",");
latitude = Double.parseDouble(line[1]);
longitude = Double.parseDouble(line[2]);
siteName = String.valueOf(line[0]);
latLngList.add(new LatLng(latitude, longitude));
siteList.add(new String(siteName));
}
for (LatLng towerLatLong : latLngList){
positionSite(towerLatLong,siteName);
}
for (String siteName : siteList) {
positionSite(towerLatLong, siteName);
}
}
catch (Exception e){
}
}
public void positionSite(LatLng towerLatLong, String siteName) {
MarkerOptions options = new MarkerOptions()
.icon(BitmapDescriptorFactory.fromAsset("ctower1.png"))
.title(siteName)
.position(towerLatLong);
mMap.addMarker(options);
}