开发者

which android list component to use?

I've developed an app that records audio and saves sample on sd card. i'd like to add a bit more functionality for example at the moment it save the sample automatically, whereas i'd like the user to be able to specify a filename and then that sample is saved und开发者_运维百科er that name on the sd card. also when playing a sample i'd like the user to be able to choose a sample from a list generated from the available samples on the sd card. this is my problem, i'm not sure which android components to use to generate a list from the samples on the sd card. can anyone point me in the right direction?

thanks


Use a ListView.

With the ListView you will create a list of your SDcard´s media.

ListView Example

UPDATE :: yes Turtleboy you will save your media files inside a directory "/sdcard/mymediafiles/"

then extract the file´s name to be displayed in your ListView!

    File sdCardRoot = Environment.getExternalStorageDirectory();
    File myDirectory = new File(sdCardRoot, "/mymediafiles/");
    for (File f : myDirectory.listFiles()) {
        if (f.isFile())     
           Log.i("Jorgesys","*** Media File :: " + f.getName());
    }


@Jorgesys suggestion of ListView is fine (+1), but you really need to think about what functionality you want to offer.

A listview would be fine if you just want to list file names.

If you have your files stroed in directories, then maybe a treeview, where you can expand and collapse the nodes (list windows explorer).

If you want to show multiple data about each sound sample (e.g file name, duration, artist, genre, etc) then use a stringgrid

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜