CodeFusionMobile
CodeFusionMobile

Reputation: 15100

Show a list of Files in android?

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?

Upvotes: 2

Views: 4465

Answers (1)

Alex Volovoy
Alex Volovoy

Reputation: 68434

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/

Upvotes: 2

Related Questions