HTTPS clone URL
Subversion checkout URL
Please sign in to comment.
[TablesAndCellStyles] Reuse View instances in Home_Adapter.
Home_Adapter.GetView() was creating a new View instance every time it was invoked without trying to reuse the `convertView` parameter. The result: excessive gref use if you scrolled a lot, eventualy resulting in app death on the emulator. There are two potential fixes: 1. Call GC.Collect() to collect all the unused instances. 2. Do this "properly", in the style of the LabelledSections sample. Of course we do (2). ;-) This involves changing Home_Adapter.GetView() to work in terms of separate ArrayAdapter instances (one for section headers, one for each section), in the style of LabelledSections, and also requires overriding BaseAdapter.ViewTypeCount and BaseAdapter.GetItemViewType() (or things crash). Unrelated, I also moved the `samples` initialization into the static constructor so that it wouldn't be repeated every time Home_Adapter is instantiated (e.g. on screen rotation). This is fine as it doesn't reference any Context instances.
- Loading branch information...
Showing with 75 additions and 46 deletions.