I am trying to display a sub-total of the database value bound to each row of my ListView. I don’t want to keep the sub-total as a database column, so I am trying to accumulate the values as they are displayed. Of course this brings up the obvious problems of how to deal with scrolling, which will display and re-display a value, messing up the running sub-total.
To elaborate, each listview row has two fields, a value and a sub-total. The value comes from a database row, the sub-total is the total of all database rows up to and including that row. I don’t want to include the sub-total into the database row if I don’t have to, because that would make inserting and deleting rows more difficult.
Any ideas?
Create a custom adapter, create an array to hold the subtotal and use that in your getView to maintain your subtotal even when scrolled.