80,351
社区成员
发帖
与我相关
我的任务
分享
String root = Environment.getExternalStorageDirectory().getAbsolutePath();
System.out.println(root);
String appDir = "abcd";
File file = new File(root,appDir);
if(!file.exists()){
file.mkdirs();
}
System.out.println(file.getAbsolutePath());
打印的路径:/storage/emulated/0/abcd 这个路径实际上是 sdcard/abcdfile.createNewFile();
//固定代码,发送广播告诉图库
MyLibsApp.mApp.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)
.setData(Uri.fromFile(file)));