开发者

Listview delete item from Database

Hey. I have the following code:

final String text = (String) lt.getItemAtPosition(position); 
                    db.r开发者_StackOverflow社区emoveCategory(text);

What I want to do is to remove a item from a ListView. The problem I have is that I only can remove the item that is in the first position of the list.

Is like the getItemAtPosition(0);

Why's that? Can somebody help?

Thanks


Bind your array to ArrayAdapter and use its remove method to remove particular object. Refer this link to get some understanding of how it works.

Remove ListView items in Android


Why don't you add items into a collection or data datable and then bind it to ListView.

In ste removal phase you delete the item from the collection/data table instead direct one from the ListView.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜