OpenAI goto hell
OpenAI goto hell

Reputation: 661

ListView with day separators

I have a ListView with different log entries that occurred in the past. Now I want to insert a "day separator" before the first entry of a new day.

I could check the surrounding entries for each row but that would mess up my index counting since my log entries are backed up by an array like list.

Any ideas? Maybe some native android stuff that I missed?

Upvotes: 0

Views: 146

Answers (1)

telkins
telkins

Reputation: 10540

You could create a new item type for your ListView to handle having a separator. In your adapter's getView() method you would then return the correct view depending on if it is a separator or regular ListView item.

Check here for an example: Sectioning your ListView

Upvotes: 1

Related Questions