2017-04-06 9 views
-2

我想獲得兩個谷歌地圖的雙。 "lonLat": "-128.1048,51.083",如何分割雙重內部字符串

String lonlat = location.getLonLat(); 
Double d = Double.parseDouble(lonlat); 
.position(new LatLng(double, double)) // Google Map 
+1

可能的複製(http://stackoverflow.com/questions/21255917/android-splitting-string-based-on - 特殊字符) –

+0

爲什麼只按「,」分割。 –

回答

1

嘗試[基於特殊字符的Android分裂字符串]這

String CurrentString = "-128.1048,51.083", 
String[] separated = CurrentString.split(","); 
separated[0]; // 
separated[1];