一.android项目的文件结构
adb shell命令下获取android系统文件的结构如下:
常用文件夹
data 保存项目文件 如:com.zhihu.android
内层文件
![]()
cache
![]()
storage
![]()
sdcard
二.各个文件的保存的文件
文件保存路径:目前先放在sdcard下 android获取路径的方法:
Environment.getExternalStorageDirectory().getPath()public static void saveBitMapToSDK(Bitmap bm) throws IOException{
String path = Environment.getExternalStorageDirectory().getPath();
Log.d(TAG, “saveBitMapToSDK: ” + path);
File dirFile = new File(path);
if(!dirFile.exists()){
dirFile.mkdir();
}
String filePath = path+”/”+getTimeStamp()+”.jpeg”;
Log.d(TAG, “saveBitMapToSDK: “+filePath);
File myCaptureFile = new File(filePath);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
}
本文介绍了Android项目的文件结构,特别是通过adb shell命令展示的数据目录结构。深入探讨了如何使用Environment类获取外部存储设备路径,并提供了将Bitmap保存到SD卡的具体实现代码。
9508

被折叠的 条评论
为什么被折叠?



