Skip to content Skip to sidebar Skip to footer

How To Sort Android ListView By Column Wise?

I've a list view in that it contain a header (like addHeaderView(layout) and Header having three columns) and when i click on first column of header then the list is to be sorted a

Solution 1:

  1. Put header for column title in listview.
  2. for multi column in listview try this.
  3. to sorting listview column, sort the list (String array[]) you providing in listview.

Solution 2:

Well in case like this in the listener you sort you adapter differently , that's it in case the A button i pressed than you sort the adapter according some criteria A, if the B button i pressed than than you sort the adapter according some criteria B. after every change you call notifyDataSetChanged();


Post a Comment for "How To Sort Android ListView By Column Wise?"