android: 根据文件uri 获取文件名
public static String getFileRealNameFromUri(Context context, Uri fileUri) {
if (context == null || fileUri == null) return null;
DocumentFile documentFile = DocumentFile.fromSingleUri(context, fileUri);
if (documentFile == null) return null;
return documentFile.getName();
}
See:
1. ContentResolver - 如何从Uri获取文件名
2. StackOverFlow: Get filename and path from URI from mediastore
android: 根据文件uri 获取文件名的更多相关文章
- FileUtils【获取SD卡根目录、读写文件、移动、复制、删除文件、获取文件名、后缀名操作类】
版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 封装了获取SD卡根目录路径.以及对文件读写.获取文件名等相关操作. 因为需要用到android.permission.READ_EX ...
- Android根据图片Uri获取图片path绝对路径的几种方法【转】
在Android 编程中经常会用到Uri转化为文件路径,如我们从相册选择图片上传至服务器,一般上传前需要对图片进行压缩,这时候就要用到图片的绝对路径. 下面对我开发中uri转path路径遇到的问题进行 ...
- android开发 根据Uri获取真实路径
Uri uri = data.getData(); String[] proj = { MediaStore.Images.Media.DATA }; Cursor actualimagecursor ...
- 从一个带有http://网络文件中获取文件名
例如文件网址为: http://a.hiphotos.baidu.com/image/h%3D200/sign=c3da85e50123dd543e73a068e108b3df/80cb39dbb6f ...
- php 遍历文件夹及文件,获取文件名和文件路径存入数据库中
<?php header("Content-Type:text/html; charset=gbk"); require('../../include/connect.php ...
- C#通过文件路径获取文件名小技巧
string fullPath = @"\WebSite1\Default.aspx"; string filename = System.IO.Path.GetFileName( ...
- php文件路径获取文件名
物理截取: $file = '/www/htdocs/inc/lib.inc.php'; $filename = basename($file); echo $filename, '<br/&g ...
- PHP 文件路径获取文件名
物理截取 $file = '/www/htdocs/inc/lib.inc.php'; $filename = basename($file); echo $filename, '<br/> ...
- C#通过文件路径获取文件名
string fullPath = @"\WebSite1\Default.aspx"; string filename = System.IO.Path.GetFileName( ...
随机推荐
- 【Python】数值运算函数
- 【C语言】用指针作为形参完成数据的升序排列
#include<stdio.h> void sort(int *x,int n); int main() { ] = { ,,,,,,,,, },i; sort(arr, ); prin ...
- DFT 问答 II
1. Boundary Scan A:Boundary scan 顾名思义,是附加在芯片I/O 周边的扫描测试链,它通过专门的测试端口(TAP)访问.在测试模式下,边界扫描链会接管功能逻辑,对I/O进 ...
- MinGW dll导入导出类
dll不仅可以导入导出函数,还可以导入导出类.这篇文章就来介绍如何将类导入dll中并导出. 首先我们建立一个名为dll.cpp的文件(又是这种破名字),里面写上: #include <iostr ...
- CefApp和CefClient的作用
CefApp 在cefsimple中,提到了一个cefapp的类型,这个类型是一个接口类,主要目的是提供获取三种handler的接口 /// // Implement this interface t ...
- kbhit函数说明
kbhit,用来检测键盘是否被敲击.所以就有了他的名字:keyboard hit 当键盘有按键被按下时,kbhit函数就会返回一个非0值. 当我们在写某个程序时,希望读入一些字符,但是又不能停在那里只 ...
- 【原】Harbor安装及使用
一.Harbor简介 Harbor是一个用于存储和分发Docker镜像的企业级私有Registry服务器. 二.Harbor安装 1.下载Harbor包 官网地址:https://github.com ...
- PHP通过thrift2访问HBASE
前一段时间需要在网页上显示HBASE查询的结果,考虑用PHP来实现,在网上搜了一下,普遍都是用thrift作为接口来实现的. 参考博文: http://www.cnblogs.com/scotom ...
- Linux kali添加root用户密码
1.1.打开终端 2.输入命令: sudo passwd root
- jquery 获取 父级 iframe 里的控件对象
window.parent.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('id')