android 快速移动sdCard的文件夹
16lz
2022-01-11
android 操作文件夹如果用java的io来操作速度非常慢,为了解决这个问题,得出如下方式,速度大大提升,分享给大家。代码如下:
public static void main(String [] args){
String fromPath = "mnt/sdCard/xuanqu";
String toPath = "mnt/sdCard/Android/data/com.test.cn/xuanqu";
File f = new File(toPath);
String command = "";
if(f.exists()) {
} else {
command = "mv " + fromPath + " " + toPath;
execCommand(command);
}
public boolean execCommand(String command){
Process process = null;
try{
process = Runtime.getRuntime().exec(command);
process.waitFor();
} catch (Exception e) {
return false;
}
return true;
}
更多相关文章
- 加快Android(安卓)Studio/Gradle构建速度
- Android中ExpandableListView控件基本使用
- android 6.0後讀取外部SD卡的路徑的方法
- android之startActivityForResult的使用
- 解决Android(安卓)Studio Gradle DSL method not found: 'androi
- Funambol android eclipse上的配置及说明
- android Handler使用
- Android编译问题:Only 64-bit build environments are supported
- Android(安卓)startActivityForResult的使用