您的位置:首页 > 其它

读取SD卡中所有MP3文件

2013-11-04 21:49 204 查看
想做一个音乐播放器,首先当然要有播放列表啊,通过查资料,暂时先做了个获取SD卡里所有MP3文件名称的小Demo,效果图如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<TextView
android:id="@+id/tv_file"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="音乐文件:" />

<TextView
android:id="@+id/tc_fileName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />

</LinearLayout>


sd_list.xml

3.最后注意添上权限

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


PS:修改下后缀文件名,也可用于查找其他类型文件 。

源代码下载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: