Right now I am trying to allow a user to select a location which will take them to it on a map. This works fine, however it is hard coded. What I want to be able to do is read in values I have stored in a text file which will then take the user to the lat and lon values on my map.
public void onMapReady(GoogleMap map) { // map is loaded but not laid out yet
this.map = map;
// code to run when the map has loaded
double lat, lon;
if (city.equals("Dublin"))
{
lat = 53.343908;
lon = -6.267554;
}
else if (city.equals("Cork"))
{
lat= 51.892751;
lon= -8.491542;
}
else
{
lat=0;
lon=0;
}
map.addMarker(new MarkerOptions()
.position(new LatLng(lat, lon))
.title("")
);
map.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(lat, lon)));
map.moveCamera(CameraUpdateFactory.zoomTo(10));
}
This is currently how I am doing it. I can supply the rest or more of my code if neccessary. Thank you for reading.