开发者

android todo list application question

i am a newbie trying to learn android by doing a todo application. so far i have:

i need help adding a delete feature my xml structure for todo list is that i have a TableLayout. and to display my todo list, i put my todo in a textview and i put that textview into a tablerow and i put that tablerow into my tablelayout.

now i want to add a delete button to the right of my todo list. my question is is there a default delete button that i can use? how do i handle the onclick event, i mean like if a click on a delete button, how do i know which todo this button is for? and is my layout correct?


Common Tasks and How to Do Them in Android


I think using a TableLayout is probably not the right way to do this. If you use a ListView, it can automatically handle adding rows when more information is added to the database, refreshing the list when information is changed, and accepting user clicks. However, a ListView is a bit more complicated to use since you have to use a ListAdapter. To be honest I've never tried creating a List directly out of an SQL database, but it's probably doable. I suggest you look for tutorials in ListViews (the ApiDemos example app Google distributes is a good place to see a few lists in action), and then look for examples binding a database to the list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜