嗨,我有两种情况一种是具有预定义值的另一种是 multiautocompletetextview。
第一个场景:
从服务器我正在检查 id。如果数据库中存在 id,则希望显示预定义的值以及 multiautocompletetextview。
如果 id 不匹配,则第二种情况想要显示 multiautocompletetextview 列表。任何人都可以帮助如何将 predifed 值设置为 multiautocompletetextview。
爪哇:
String isbookingexist=getArguments().getString("isBookingexist");
if(isbookingexist.equals("true")){
FetchPatientMedicalDetails();
GetPreExistingConditionList();
}
预定义值:
FetchPatientMedicalDetails(){
pre_condition=medicalDataList.getExistingCondtn();
}
完整列表:
private void GetPreExistingConditionList() {
final APIService service = RetroClass.getRetrofitInstance().create(APIService.class);
Call<MedicalInformationModel> call = service.GetMedicalInformationDropDownList();
Log.wtf("URL Called", call.request().url() + "");
call.enqueue(new Callback<MedicalInformationModel>() {
@Override
public void onResponse(Call<MedicalInformationModel> call, Response<MedicalInformationModel> response) {
Log.e("response", new Gson().toJson(response.body()));
if (response.isSuccessful()) {
Log.e("response", new Gson().toJson(response.body()));
MedicalInformationModel medicalInformationModel = response.body();
final ArrayList<PreExistingCondition_DropdownList> preExistingCondition = medicalInformationModel.getPreExistingCondition();
final ArrayList<Allergies_DropdownList> allergies_dropdown=medicalInformationModel.getAllergies();
final ArrayList<Symptoms_DropdownList> symptoms_dropdown=medicalInformationModel.getSymptoms();
final ArrayList<Complaints_DropdownList> complaints_dropdown=medicalInformationModel.getComplaints();
//Pre Existing Conditions Dropdownlist
for (PreExistingCondition_DropdownList preExistingCondition_dropdownList : preExistingCondition) {
String Id = preExistingCondition_dropdownList.getId();
String Conditions=preExistingCondition_dropdownList.getCondition();
PreExistingCondition_DropdownList preExistingCondition_dropdownList1 = new PreExistingCondition_DropdownList(Id,Conditions);
preExistingCondition_dropdownLists.add(preExistingCondition_dropdownList1);
Pre_Conditions.add(Conditions);
pre_existing_condition.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
PreExistingCondition_DropdownList preExistingCondition_dropdownList1=preExistingCondition_dropdownLists.get(position);
preconid=preExistingCondition_dropdownList1.getId();
precontname=preExistingCondition_dropdownList1.getCondition();
}
});
}
}
}
@Override
public void onFailure(Call<MedicalInformationModel> call, Throwable t) {
Log.d("error", t.getMessage());
}
});
}