怎么实现搜索相关文件~~??????????????????? 比如,我要搜索位于sdcard里的所有的.mp3文件,或者.lrc ,.txt等。应该怎么去实现???多谢!回答正确 追加50分~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 File f = new File("/your/file/path"); File[] files = f.listFiles(); private List<String> lists; private void GetFileList(String strPath){ File file = new File(strPath); file.listFiles(new FileFilter() { @Override public boolean accept(File f) { // TODO Auto-generated method stub if(isMp3File(f.getPath())) lists.add(f.getPath()); else if(f.isDirectory()){ GetFileList(f.getPath()); } return false; } }); } private boolean isMp3File(String strPath){ String strExtend = strPath.substring(strPath.lastIndexOf(".")+1, strPath.length()).toLowerCase(); if(strExtend.equals("mp3")) return true; return false; }试试吧! android 缓存数据的问题 动态生成的RadioButton应该怎么监听呢? 关于android中UI线程与渲染线程的问题 请大家帮个忙!!问一个小小的问题!!! 准备学习Opengl es,没找到好的学习资料,请大家帮忙推荐一些资料吧! ImageView出错 生成Drawable问题 android程序跑起来需要的最低配置是多少呢?请教大虾们啊~~~ TabActiviy中子Activity跳转到其他Activity后仍显示TAB Android项目出现一个问题,求解答!!!! 关于receiver如何把信息传递给程序 求解Preference布局问题
File[] files = f.listFiles();
private void GetFileList(String strPath){
File file = new File(strPath);
file.listFiles(new FileFilter() {
@Override
public boolean accept(File f) {
// TODO Auto-generated method stub
if(isMp3File(f.getPath()))
lists.add(f.getPath());
else if(f.isDirectory()){
GetFileList(f.getPath());
}
return false;
}
});
}
private boolean isMp3File(String strPath){
String strExtend = strPath.substring(strPath.lastIndexOf(".")+1, strPath.length()).toLowerCase();
if(strExtend.equals("mp3"))
return true;
return false;
}试试吧!