Android: Reading a large CSV file efficiently? -
i have large csv file (about 12000 lines) need parse , display in listview.
i don't want load entire file in memory, want read in 10 lines groups , when user clicks "load more" button, next 10 lines read , on.
any recommendations on how achieve in efficient way ?
thanks
well, here's starting point:
step #1: create arrayadapter
, data model array of read-in rows
step #2: override getcount()
return array size plus 1, accommodate "load more" row
step #3: override getviewtypecount()
return 2 (or more, if listview
rows csv rows not same -- assume same rest of answer, 2 types "regular row" , "'load more' row")
step #4: override getitemviewtype()
return 1 when position equal array size, or 0 lower that
step #5: override getview()
return appropriate row, including returning "load more" row
step #6: when user clicks "load more" row, run through logic read in next csv lines, adding them array, calling notifydatasetchanged()
on adapter alert listview
data has changed
Comments
Post a Comment