I'm having some issues inflating some views. I have an arraylist with objects of Events. The events has got their individual layouts. If two events has got the same date I want to combine them in a layout and then I want to add all events to a new arraylist. This is my start:
ArrayList<Event> events = getEventlist();
ArrayList<View> eventListWithDates = new ArrayList<View>();
for(int i = 0; i < events.size(); i++){
String date1 = "0";
String date2 = "1";
if(i != 0){
date1 = events.get(i-1).getDate();
date2 = events.get(i).getDate();
}
if(date1.equals(date2)){
/* This is where I need your help.
How do I add the current event to the last eventView? */
} else {
View view = getLayoutInflater().inflate(R.layout.datehead, calendarLayout, false);
LinearLayout eventView = (LinearLayout) findViewById(R.id.eventView);
eventView.addView(events.get(i).getEvent());
eventListWithDates.add(view);
}
}
Hope you understood what I want to do. Any ideas?