Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android :How can i make a list of events day wise.?

I am working in android. I want to show a list of events. I can make this list using listView.

But i want to add Day just before the list of events. Means i have two arrayList

  1. for Name of days
  2. for name of events for a day

So please suggest me how can i implement this.? you can provide me link related this topic or give a code help.

I need like this :--- enter image description here

Thank you in advance.

like image 224
Pushpendra Kuntal Avatar asked Nov 28 '25 13:11

Pushpendra Kuntal


2 Answers

You can either use Sectioned ListView(You have to customize ListView) or Expandable ListView(inbuilt).

Sectioned ListView examples:

  • Android – Sectioned Headers in ListViews ,
  • ListView Tips & Tricks #2: Section your ListView

Expandable ListView examples:

  • ExpandableListView on Android
  • Steps to implement ExpandableListView in android - Check the Step - 2 in this example, same way groups[] and children[][], you can implement your 2 arraylists accordingly.
like image 193
Paresh Mayani Avatar answered Nov 30 '25 03:11

Paresh Mayani


You can use a SimpleAdapter and bind the Name of the days to one TextView and the event name to another TextView. Your xml layout will then just be a LinearLayout, oriented horizontally, with two TextViews in it. Here's an example.

like image 29
Kurtis Nusbaum Avatar answered Nov 30 '25 02:11

Kurtis Nusbaum