[
{"title_ru":"Двойной форсаж","kinopoisk_id":"323"},
{"title_ru":"Экс-любовник","kinopoisk_id":"171822"}
]
public class ModelSearch {
@SerializedName("title_ru")
private String title_ru;
@SerializedName("kinopoisk_id")
private String kinopoisk_id;
public String getTitle() {
return title_ru;
}
public void setTitle(String title_ru) {
this.title_ru = title_ru;
}
public String getKP() {
return kinopoisk_id;
}
public void setKP(String kinopoisk_id) {
this.kinopoisk_id = kinopoisk_id;
}
call.enqueue(new Callback<ModelSearchMoon>() {
@Override
public void onResponse(Call<ModelSearchMoon> call, Response<ModelSearchMoon> response) {
final int kpID = response.body().getKinopoisk_id();
Log.d("TEST", "kpID="+kpID);
}
@Override
public void onFailure(Call<ModelSearchMoon> call, Throwable t) {
}
});
public class ModelSearchMoon {
@Expose
private List<Upd> updates;
public List<Upd> getUpdates() {
return updates;
}
public void setUpdates(List<Upd> updates) {
this.updates = updates;
}
public int getSizeUpdates() {
return updates.size();
}
public class Upd {
@SerializedName("kinopoisk_id")
private int kinopoisk_id;
@SerializedName("added_at")
private String added_at;
public int getKinopoisk_id() {
return kinopoisk_id;
}
public void setKinopoisk_id(int kinopoisk_id) {
this.kinopoisk_id = kinopoisk_id;
}
public String getAdded_at() {
return added_at;
}
public void setAdded_at(String added_at) {
this.added_at = added_at;
}
}
}
call.enqueue(new Callback<ModelSearchMoon>() {
@Override
public void onResponse(Call<ModelSearchMoon> call, Response<ModelSearchMoon> response) {
if (response.body().getSizeUpdates()>0) {
for (int r = 0; r < response.body().getSizeUpdates(); r++) {
final int kpID = response.body().getUpdates().get(r).getKinopoisk_id();
Log.d("TEST", "kpID="+kpID);
}
}
}
@Override
public void onFailure(Call<ModelSearchMoon> call, Throwable t) {
}
});
public class ModelSearchMoon {
List<ModelSearchMoon> modelSearchMoons;
public List<ModelSearchMoon> getModelSearchMoons() {
return modelSearchMoons;
}
public void setModelSearchMoons(List<ModelSearchMoon> modelSearchMoons) {
this.modelSearchMoons = modelSearchMoons;
}
public int getModelSearchMoonsSize() {
return modelSearchMoons.size();
}
}