Question

I've created a TableLayout and added rows to it dynamically. I want to sort table content on column header click. Just as in HTML, we can easily sort data using datatables. Can I implement the same functionality in Android TableLayout using some jar files or existing Android functions?

Thanks in advance.

Was it helpful?

Solution

See, you can use Collection.sort() for it.

There are so many tutorials on it. see arraylist-example-using-collections-sort. this is logic for sorting. you can make a method that you can execute on your table header click.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top