It sounds like the issue with your RecyclerView is that you are not properly handling the position
when binding data from different lists. Since you're trying to display the last entries of each list, the logic for determining which entry to show is misaligned.
You can try the below solution:
Change how you handle positions in onBindViewHolder
: Instead of assuming the same position across different lists, you should calculate the position based on the sizes of the lists.
Bind data only if the position is within the bounds of the list: Check if you are trying to access an index that exists in each list.
Here’s an updated version of your onBindViewHolder
method:
@Override
public void onBindViewHolder(@NonNull EntryViewHolder holder, int position) {
Entry_Pagination entry;
if (position < lagerhausEntries.size()) {
entry = lagerhausEntries.get(position);
holder.bindEntry("liezen_lagerhaus_tankstelle", entry);
} else if (position < lagerhausEntries.size() + jetEntries.size()) {
entry = jetEntries.get(position - lagerhausEntries.size());
holder.bindEntry("liezen_jet_tankstelle", entry);
} else {
entry = shellEntries.get(position - lagerhausEntries.size() - jetEntries.size());
holder.bindEntry("trautenfels_shell_tankstelle", entry);
}
}
Alles anzeigen
By ensuring that each position corresponds to the correct entry in its respective list, you should see the last entries displayed correctly in the RecyclerView.