开发者

How can we add sounds, in a memory card, in Android?

How can we add sounds, in a memory card, in Andr开发者_如何转开发oid?


The following code will add all the media file available on sdcard:

    private static final String MEDIA_PATH = new String("/sdcard/");
    public List<String> songs = new ArrayList<String>();

    private void updateSongList() 
    {
        File home = new File(MEDIA_PATH);
        if (home.listFiles( new Mp3Filter()).length > 0) 
        {
            for (File file : home.listFiles( new Mp3Filter())) 
            {
                songs.add(file.getName());
            }                       
        }
    }

By using file explorer you can transfer the media files from your system to sdcard.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜