Improving my ListViews
A more productive day today. I was using an ArrayList of custom objects to back my ListView. This was fine for a short list of items, but got fiddly once I allowed the user to make changes to the list (check a box). This required me to update the ArrayList content and the db. Turned into a mess and never really got anywhere with it. That was yesterday. Today I changed my implementation to be backed by a Cursor directly. Had to work out how to use newView and bindView, but it was worth the effort. This implementation will be much more portable in other implementations.
Got tripped up by this line:
daysRemaining.setText(DateFactory.dateDiff(todaysDate, endDate));
This was trying to set the text value to be an int. A nice type error would result in straight java, but in Android the system was looking for a resource id equivalent to the value returned by DateFactory. A fiddly bug to find, but all done now.
Getting more comfortable with the basics now, so hopefully will get to a point where I am speeding up a bit. Taking some time to learn the technology is one thing, but the pace so far has been slow. Not much to tell my wife in the evening when she asks me 'what did you do today?'
Got tripped up by this line:
daysRemaining.setText(DateFactory.dateDiff(todaysDate, endDate));
This was trying to set the text value to be an int. A nice type error would result in straight java, but in Android the system was looking for a resource id equivalent to the value returned by DateFactory. A fiddly bug to find, but all done now.
Getting more comfortable with the basics now, so hopefully will get to a point where I am speeding up a bit. Taking some time to learn the technology is one thing, but the pace so far has been slow. Not much to tell my wife in the evening when she asks me 'what did you do today?'
Comments
Post a Comment