Answer the question
In order to leave comments, you need to log in
How to correctly write a model for Retrofit2 and get data?
How to correctly write a model for Retrofit2 and get data?
Here is the api:
http://maps.googleapis.com/maps/api/geocode/json?address=Москва,%20город%20Москва,%20Россия&sensor=false
public class GeoModel
{
@Expose
private List<Results> results;
@Expose
private List<Geometry> geometry;
public List<Results> getResults() {
return results;
}
public int getRezUpdates() {
return results.size();
}
public class Results
{
@SerializedName("geometry")
private String geometry;
public String getGeometry() {
return geometry;
}
}
public class Geometry
{
@SerializedName("geometryData")
private String geometryData;
public String getGeometryData() {
return geometryData;
}
}
}
Answer the question
In order to leave comments, you need to log in
Given the given json
"geometry" : {
"bounds" : {
...
},
"location" : {
"lat" : 55.755826,
"lng" : 37.6173
},
...
public class Geometry
{
private Location location;
//геттер,сеттер
}
class Location {
private String lat;
private String lng;
//геттеры,сеттеры
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question