Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tablelayout with massive data android

What is the best way to create a table layout or recyclerview/listview/gridview in android that can pull a lot of data around 1000 rows and around 50 columns each row without to crash ?

I want to show it like excel sheet nothing special just show data of course with scrolling both ways.

like image 938
user3341575 Avatar asked Jan 27 '26 12:01

user3341575


2 Answers

TableFixHeaders project on github has an implementation with both Adapter an Recycling of views, plus handles scrolling wery nicely. And is quite easy to modify to suit your needs.

enter image description here

This is not so uncommon request, so it has been done numerous times. I am sure you can find other implementations if this one is not right for you.

like image 76
Štarke Avatar answered Jan 30 '26 04:01

Štarke


I saw a similar question on SO a few months ago, and I was interested to see if I could develop a solution.

My concept was to start with a ListView for vertical scrolling and view recycling. Each list item is a HorizontalScrollView to show a table row with many columns. The trick here is to listen to each HorizontalScrollView for swipe events and then scroll every HorizontalScrollView in sync with the view being swiped.

I have a proof-of-concept project on Github here: klarson2/android-table-test

Downsides: The project was set up for Eclipse, so you can't open it directly with Android Studio. There is still a small bug with event handling that I haven't got around to fixing. Another limitation is that each cell view in the horizontal LinearLayout must be a fixed size so that the columns will line up correctly.

However, the example uses a 4MB .csv file with 50 columns and over 10,000 rows for a data source proving that it is possible to display an enormous table in an Android app with responsive two-way scrolling.

like image 23
kris larson Avatar answered Jan 30 '26 04:01

kris larson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!