// 初始化recList
public void initRecList() {
new Thread() {
public void run() {
try {
sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
doInHandler();
};
}.start();
}
public void doInHandler() {
if (!SDCard.getFileSavePath(pathString).toString().equals(null)) {
recList.clear();
handler.post(new Runnable() {
public void run() {
// 取得指定位置的文件,添加到recList中
File home = new File(pathString);
if (home.listFiles(new MusicFilter()).length > 0) {
for (File file : home.listFiles(new MusicFilter())) {
// 将录音文件的路径添加进recList
recList.add(file.getPath().toString());
}
}
recAdapter = new ListRecAdapter(getApplicationContext(),
recList);
recListView.setAdapter(recAdapter);
// 关闭滚动条
progressdialog.dismiss();
}
});
} else {
ShowMsg.showToast(getApplicationContext(), "请插入内存卡!");
}
}