I'm trying to create a to do list in android, where each item is a checkbox. I want to be able to programmatically update the list of items as the user (me) adds a new task. Any tips for how I could accomp开发者_开发知识库lish this?
As suggested notepad tutorial would be good here is a few design tips:
- You probably need to create layout with listview
- Then create another layout for your list rows to inflate which is in your case checkbox
- Create adapter for listview to set items by extending ArrayAdapter.
- Implement getView method and constructor of adapter class
- If user add something to list notify adapter that data set has changed and update ui accordingly
Note : do not update UI from background thread just use UI thread for this
Note 2 : In lists android have row recycle so when list expend the screen width check if checkboxes hold their states.
Hope it helps.
精彩评论