1

I have to create a listview in which there will be a date as header , then some list stuffs of daily views and at footer there will be total views of particular date.

Like this:

Date:dd/mm/yyyy

type 1 : 5

type 2 : 4

type 3 : 1

. . .

Today's total types: 10..

Here everything will be fetched from the sqlite database so please kindly suggest me something related to this.

Thanks in advance.

Chirag Gohil
  • 352
  • 1
  • 2
  • 14
  • This question is unclear. How are you categorizing/calculating daily views here? – Sudip Podder Jun 19 '16 at 20:25
  • @SudipPodder its from the web service, so he will just fetch the data to the server, no more algo for that – Rashid Jun 20 '16 at 01:23
  • I was actually confusing with the 'view' term. never mind, probably he got his answer in the answer section provided by Evin_1 :) – Sudip Podder Jun 20 '16 at 07:43
  • @SudipPodder actually view is just for example it means there are different lists I will use like, for example there are 5 types of songs, in song type 1 there will be 10 songs, type 2 15 songs,.... and in total of everyday there will be total songs of all types.. – Chirag Gohil Jun 21 '16 at 10:31

1 Answers1

1

There are 2 solutions:


Use the addHeaderView and addFooterView methods of the ListView.

Using ListView : How to add a header view?

How to add a footer in ListView?


Overriding getViewTypeCount() and getItemViewType() of your custom adapter.

getViewTypeCount and getItemViewType methods of ArrayAdapter

Community
  • 1
  • 1
Evin1_
  • 12,292
  • 9
  • 45
  • 47