首页 > 系统 > Android > 正文

Android创建文件夹

2019-11-09 17:20:18
字体:
来源:转载
供稿:网友

一。创建文件

//获取sd卡路径public static String SDPATH= Environment.getExternalStorageDirectory().getAbsolutePath() + "/";//创建文件public void creatSDDir(String dirName){File file = new file(dirName);if(!file.exists())file.mkdir;//创建单一文件夹file.mkdirs;//创建多个文件夹(例如:/data/pms/database)}//创建文件public void createFile(String fileName)throws IOException {File file = new File(SDPATH+fileName);if(!file.exists())file.createNewFile();}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表