Question

I'd like to create a very simple android activity that takes a file path on the sd card and displays the contents of that directory in a listview.

I know how to get a list of the files via File.listFiles() which returns an Array of File objects. What I want to know is how I can adapt that array to a ListView. Would an ArrayAdapter be the right thing to use and how would I do that?

Was it helpful?

Solution

ArrayAdapter would work. But i'd create my own extending it from BaseAdapter just in case i'd want to do something more fancier. There plenty of examples on android site and i'd recommend Mark books at http://commonsware.com/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top