
In my upcoming Android app I populate a ListView with rows from database. For this task SimpleCursorAdapter exists, which maps rows from a query to fields in a view. Unfortunately that mapping is limited to text-only, i.e. toString() calls. I on the other hand want to change pictures, adjust progress-bars’ fills and compute progress. Hence the need for a custom cursor adapter.
In older examples CursorAdapter.getView is overwritten, which is deprecated and no good, as it is called twice per run and you won’t be able to manage the cursor – which is a must as it won’t get updated and will always point to the same row. Instead, you (and me) should override SimpleCursorAdapter.bindView as follows: Read more »
Tags: Android, java, tutorial