Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
764 views
in Technique[技术] by (71.8m points)

android - Remove selected item from ListView

I want to delete the selected item from the ListView but I can't. I've tried a lot of methods but they aren't working for me.

This is my adapter list- items are coming from the SD Card.

ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                        FindFilesByType.this, android.R.layout.test_list_item,
                        Ringtones); 

How do I solve this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can remove the item from the underlying list and signal the adapter, that the dataset has changed.

Have a look at this method for an example.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...