`
liangoogle
  • 浏览: 273208 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

从存储卡中读取带特定后缀的文件

 
阅读更多

从sd卡中找出:

后缀为.vcf的所有文件:

    public static File[] getcontactList() {

        File root = new File(getBackUpPath());

        File[] l = root.listFiles(new FilenameFilter() {

 

            @Override

            public boolean accept(File dir, String filename) {

                if (filename.endsWith(".vcf")) {

                    return true;

                }

                return false;

            }

        });

        return l;//l为file数组。

    }

 

    public static String getBackUpPath() {

        return "/mnt/sdcard";//在指定目录中查找。

    }


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics