android本地视频封装uri,android - 如何获取由Intent在Android Studio中使用其Uri选择的一个视频的路径? - 堆栈内存溢出...

我想使用该路径将视频复制到另一个目录,但是抛出的错误提示我的URI或路径不存在。

probar.setOnClickListener({

val selectedImageUri2=globalVariable.video//here I just saved the uri path of the intent

if(!CheckPermissionFromDevice()){

requestPermission()

} else {

val sourcePath = Environment.getExternalStorageDirectory().absolutePath +"/"+ selectedImageUri2.toString()

Toast.makeText(this, "SOURCE PATH:: "+sourcePath, Toast.LENGTH_SHORT).show()

println("SOURCE"+sourcePath)

val source= File(sourcePath)

val destinationPath = Environment.getExternalStorageDirectory().absolutePath + "/AudioFiscalia/"

val destination = File(destinationPath)

try {

FileUtils.copyFile(source, destination)

Toast.makeText(applicationContext, "TRY BIEN", Toast.LENGTH_LONG).show()

} catch (e: IOException) {

e.printStackTrace()

Toast.makeText(applicationContext, "CATCH"+e.toString(), Toast.LENGTH_LONG).show()

println("error"+e.toString())

}

}

})

这是我的错误:来源'/storage/emulated/0/content:/com.android.externalstorage.documents/document/primary%3ADCIM%2FHDCamera%2FVID_20190903_114707.mp4'不存在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值