For parse data I use retrofit (gson) library. I have problems with parsing double value 'position'. The full JSON you can see here below. I parse String array 'words' great but with double value I have nothing in TextView. Can anyone say what exactly wrong and what I need to fix and what I missed?
Thanks for any help!
JSON
MainActivity.java
w3wNetworkFactory.w3wGetInstance().w3wGetApiCall().getPosition(w3w_API_KEY, new Words("gliders.inquest.hardly"), new Callback<PositionResponse>() {
@Override
public void success(PositionResponse positionResponse, Response response) {
position_w3w.setText(Arrays.toString(positionResponse.getPosition()).replaceAll("\\[|\\]", ""));
//Log.d("w3w location: ", Arrays.toString(positionResponse.getPosition()));
String mLatLng = Arrays.toString(positionResponse.getPosition()).replaceAll("\\[|\\]", "");
//Convert String to double
double value = Double.parseDouble(mLatLng);
//Set marker to map
mGoogleMap.addMarker(new MarkerOptions().position(value)
.title("Geolocation system")
.snippet("Your last current location which was available!")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_location)));
}
@Override
public void failure(RetrofitError error) {
error.toString();
}
});
PositionResponse.java
public class PositionResponse {
private double[] position;
public double[] getPosition() {
return position;
}
}