我在下面的代码中遇到错误(System.FormatException:输入字符串的格式不正确。),为什么。我的代码工作正常,但现在我不知道为什么。 我正试图从地图上的json获取坐标
public void initializeMap(String content)
{
LatLng location = new LatLng(codecLatitude, codecLongitude); // setting latitude and longitude
// getting MapFragment
mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
// setting MapFragment to googleMap variable
google = mapFragment.Map;
if (google != null)
{
google.MapType = GoogleMap.MapTypeNormal; // setting map type
// creating marker
try
{
JSONArray json = new JSONArray(content);
for (int i = 0; i < json.Length(); i++)
{
JSONObject obj = json.GetJSONObject(i);
String lati = obj.GetString("latitude");
String longi = obj.GetString("longitude");
String full = obj.GetString("fullname");
String mobi = obj.GetString("mobile");
String id = obj.GetString("driver_id");
String token = obj.GetString("token");
String cartype = obj.GetString("car_type");
MarkerOptions marker = new MarkerOptions()
.SetPosition(new LatLng(Double.Parse(lati), Double.Parse(longi)))
.SetTitle(full)
.SetSnippet(mobi);
if (cartype == "ركشة")
{
marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.iconreksha));
}
else
{
marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.carmark));
}
google.AddMarker(marker); // add marker to google Map
错误消息指示器指向以下行
MarkerOptions marker = new MarkerOptions()
.SetPosition(new LatLng(Double.Parse(lati), Double.Parse(longi)))
.SetTitle(full)
.SetSnippet(mobi);