Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:Listview具有多个适配器_Android_Android Listview - Fatal编程技术网

Android:Listview具有多个适配器

Android:Listview具有多个适配器,android,android-listview,Android,Android Listview,我试图使用多个ArrayList和ArrayList来显示如下所示的Android列表视图。但我无法实现这种结构ArrayList是从数据库填充的,而Array是本地创建的ArrayList。如何匹配ArrayList中的时间和ArrayList中的时间是一个问题 请参考下图了解更多详细信息并帮助我 顺便说一下,可用的文本不是来自数据库。如果没有特定插槽的预约,我希望以编程方式显示可用插槽 提前感谢。尝试使用包含ArrayList PatientPointList和ArrayList时间段的对象

我试图使用多个
ArrayList
ArrayList
来显示如下所示的Android列表视图。但我无法实现这种结构
ArrayList
是从数据库填充的,而
Array
是本地创建的ArrayList。如何匹配
ArrayList
中的时间和
ArrayList
中的时间是一个问题

请参考下图了解更多详细信息并帮助我

顺便说一下,可用的文本不是来自数据库。如果没有特定插槽的预约,我希望以编程方式显示可用插槽


提前感谢。

尝试使用包含ArrayList PatientPointList和ArrayList时间段的对象ArrayList约会

任命结构:

public class Appointment {
    TimeSlot timeSlot;
    PatientAppointmentList patientAppointmentList;

    public Appointment(TimeSlot timeslot, AppointmentList appointmentList) {
        this.timeSlot = timeSlot;
        this.appointmentList = appointmentList;
    }
}
为每个PatientAppointList添加时间段:

ArrayList<Appointment> appointments = new ArrayList<>();
for (int i = 0; i < patientAppointmentList.size(); i++) {
    appointments.add(new Appointment(new TimeSlot, new PatientAppointmentList));
}
ArrayList约会=新建ArrayList();
for(int i=0;i
使用ArrayList HashMap组合两个列表数据

ArrayList<HashMap<String,Object>> list = new ArrayList<HashMap<String, Object>>();
TimeSlot[] timeSlotList;
for (int i=0;i<timeSlotList.length;i++){
     HashMap<String,Object> row = new HashMap<String, Object>();
     row.put("slot_time",timeSlotList[i]);
     // try to get data from your database base on TimeSlot and check if data is not available for this time slot put available static string other wise add data which are came from database.
     ArrayList<PatientAppointmentList> appointmentList = getAppointmentFromDatabase(timeSlotList.get(i));
     if(appointmentList != null && appointmentList.size() > 0){
         row.put("appointment_status",getAppointmentFromDatabase(timeSlotList.get(i)));
     }else{
         row.put("appointment_status","Available");
     } 
     list.add(row);
}
ArrayList list=new ArrayList();
时隙[]时隙列表;
对于(int i=0;i 0){
row.put(“约会\状态”,getAppointmentFromDatabase(timeSlotList.get(i));
}否则{
第行“预约状态”、“可用”);
} 
列表。添加(行);
}

yourAdapter=新适配器(Activity Activity,ArrayList,ArrayList)@Naveentamakar请详细说明Naveen,我没有得到你的答案。你知道coustem adapterKaspar吗?如果两个阵列的大小不一样呢。我是说我有12个小时的时间从09:00到21:00,在约会列表中,我每天可能只有一个约会。你可以添加空约会,当你在屏幕上显示它时,你可以只显示可用的约会。Haresh Chhelana:如果两个数组的大小不一样呢?如果两个数组的大小不一样,那么你如何区分哪个约会的时段?我编辑了我的问题。状态“可用”不是来自数据库。问题是PatientPointmentList的时间为2014年11月18日11:30至2014年11月18日12:00,我想在我的时隙数组列表中匹配此11:30-12:00,并显示在listview中。如果不可能,请原谅我。