Context : I Have a model Book that contains 1 ArrayList of type Flight, the flight model contains an array of legs.
Question: I need to show all legs in one listView, but i need it separated by flight, each flight should have a header with the departure date. The problem i'm facing is that in the adapter i can't access booth data models. For example in IOS i can show it with the indexPath, indexpath.section for flights and indexPath.row for the legs, i'm looking for something like a UITableViewController.
Here is what i already have.
public int getCount() {
return bookingsDetailModel.getFlights().size();
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
SILeg leg = bookingsDetailModel.getFlights().get(position).getFlightLegs()[position];
return viewHolder;
}
I'm only able to access one leg of each flight, and each flights can have more than 2 legs.
Any Help will be much appreciated