Android - 将文件保存到Windows Exploer手机USB模式下可见的文件夹

时间:2016-05-13 17:44:58

标签: android storage

我正在尝试将文件保存到以USB模式连接手机时在Windows资源管理器中可见的路径。

  public static boolean sharedSetTextAsStrToDCIMStoragePath(Context ctx, String relative_dir, String file_name, String str, boolean mode_append)
  {
    File storage_files_dir_file = ctx.getExternalFilesDir(Environment.DIRECTORY_DCIM);
    if (storage_files_dir_file.exists() == false) {
      return false;
    }
    sharedSetTextAsStrToCustomStoragePath(storage_files_dir_file, relative_dir, file_name, str, mode_append);
    MediaScannerConnection.scanFile(ctx, new String[] {storage_files_dir_file.toString()}, null, null);
    return true;
  }

我尝试了各种路径 - 例如下载和dcim,因为它们在Windows资源管理器中可见。

但是,在Windows资源管理器中,我看不到我创建的文件,即使我可以看到在单步执行代码时正在创建文件。

以下是Windows资源管理器中的示例地址:

"此电脑\ HUAWEI P6-U06 \内部存储\ DCIM \"

我在Android中保存时获得的路径是:

" /storage/emulated/0/Android/data/com.company.product.app/files/DCIM"

0 个答案:

没有答案
相关问题