我有一个自定义适配器,我想用它来填充我的微调器。我正在使用改造,我想从 JSon 文件中获取响应并将其传递给微调器。我试图将列表项调用到微调器,但我被卡住了。我是 android 和 Java 的新手。提前致谢
Call<RegistrationDropdownResponse> call = apiService.dropDownresponse(commonRequest);
call.enqueue(new Callback<RegistrationDropdownResponse>() {
@Override
public void onResponse(Call<RegistrationDropdownResponse> call, Response<RegistrationDropdownResponse> response) {
if (response.isSuccessful()) {
Log.e("RESPONSE", new Gson().toJson(response.body()));
Constants.registrationDropdownResponse = response.body();
CustomAdapter adapter = new CustomAdapter(this,);
spCompany.setAdapter(adapter);
}
}
@Override
public void onFailure(Call<RegistrationDropdownResponse> call, Throwable t) {
}
});
这是我的回复课
public class RegistrationDropdownResponse {
private List<MaritalStatus> marital;
private List<IncomeBand> income;
private List<EducationLevel> education;
private List<Rental> rental;
private List<EmploymentLevel> employment;
public List<MaritalStatus> getMarital() {
return marital;
}
public List<IncomeBand> getIncome() {
return income;
}
public List<EducationLevel> getEducation() {
return education;
}
public List<Rental> getRental() {
return rental;
}
public List<EmploymentLevel> getEmployment() {
return employment;
}
}
湖上湖
相关分类