Fel*_*lix 7 android uri kotlin
如何在 Kotlin 而不是 java (Android) 中将字符串转换为 Uri?
val Uri_string = "/sdcard/example.jpg"
Run Code Online (Sandbox Code Playgroud)
uri_string = ???;
val uri = Uri.parse(Uri_string)
Run Code Online (Sandbox Code Playgroud)
或者
val fileName = "example.jpg"
val path = "${Environment.getExternalStorageDirectory()}/$fileName"
val file = File(path);
val uri = Uri.fromFile(file);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5059 次 |
| 最近记录: |