У меня есть этот код для получения информации от API
public class MainModel implements InterfacesSpace.MAIN_MODEL {
List<CountryModel> ARRAYS;
@Override
public List<CountryModel> Weather_Information() {
final Call<CountryModel.ResultModel> connection = INSTANCE_API_SERVICE.loadItems();
connection.enqueue(new Callback<CountryModel.ResultModel>() {
@Override
public void onResponse(Call<CountryModel.ResultModel> call, Response<CountryModel.ResultModel> response) {
countryModels = response.body().getCountryModels();
for (int i = 0; i < countryModels.size(); i++) {
CountryModel ye = new CountryModel("","","");
ye.setCountry(countryModels.get(i).getCountry());
ye.setCity(countryModels.get(i).getCity());
ye.setDegree(countryModels.get(i).getDegree());
ARRAYS.add(ye);
//Log.e("TESTSAIF" ,ARRAYS.get(0).getCity());
// Log.e("array size ", String.valueOf(ARRAYS.size()));
// Log.e("Size", String.valueOf(arrayList.size()));
}
}
@Override
public void onFailure(Call<CountryModel.ResultModel> call, Throwable t) {
Log.e("error",t.getMessage());
}
});
// return ARRAYS.get(0);
return ARRAYS;
}
, и в моем классе Presnter эта функция
@Override
public void Request_weather_Information() {
MODEL_INSTANCE.Establishing_DB_Communication();
Log.e("test", String.valueOf(MODEL_INSTANCE.getsizearry()));
// Log.e("Size", String.valueOf(MODEL_INSTANCE.Weather_Information().getCity()));
}
сообщение об ошибке: 'int java.util.List.size () 'для пустой ссылки на объект, почему это произошло