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 获取文件名的更多相关文章

  1. FileUtils【获取SD卡根目录、读写文件、移动、复制、删除文件、获取文件名、后缀名操作类】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 封装了获取SD卡根目录路径.以及对文件读写.获取文件名等相关操作. 因为需要用到android.permission.READ_EX ...

  2. Android根据图片Uri获取图片path绝对路径的几种方法【转】

    在Android 编程中经常会用到Uri转化为文件路径,如我们从相册选择图片上传至服务器,一般上传前需要对图片进行压缩,这时候就要用到图片的绝对路径. 下面对我开发中uri转path路径遇到的问题进行 ...

  3. android开发 根据Uri获取真实路径

    Uri uri = data.getData(); String[] proj = { MediaStore.Images.Media.DATA }; Cursor actualimagecursor ...

  4. 从一个带有http://网络文件中获取文件名

    例如文件网址为: http://a.hiphotos.baidu.com/image/h%3D200/sign=c3da85e50123dd543e73a068e108b3df/80cb39dbb6f ...

  5. php 遍历文件夹及文件,获取文件名和文件路径存入数据库中

    <?php header("Content-Type:text/html; charset=gbk"); require('../../include/connect.php ...

  6. C#通过文件路径获取文件名小技巧

    string fullPath = @"\WebSite1\Default.aspx"; string filename = System.IO.Path.GetFileName( ...

  7. php文件路径获取文件名

    物理截取: $file = '/www/htdocs/inc/lib.inc.php'; $filename = basename($file); echo $filename, '<br/&g ...

  8. PHP 文件路径获取文件名

    物理截取 $file = '/www/htdocs/inc/lib.inc.php'; $filename = basename($file); echo $filename, '<br/> ...

  9. C#通过文件路径获取文件名

    string fullPath = @"\WebSite1\Default.aspx"; string filename = System.IO.Path.GetFileName( ...

随机推荐

  1. AC3 channel coupling

    1.overview 如果使用channel coupling, encoder端计算所有channel的transform coefficients的平均值,将平均值压缩到coupling chan ...

  2. 【转载】Java泛型(二)

    转自:http://www.cnblogs.com/lwbqqyumidi/p/3837629.html 一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下面这段简短的代码: 1 public ...

  3. c#中的栈(stack)与队列(queue)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  4. 修改vsftpd的默认根目录/var/ftp/pub到其他目录

    修改ftp的根目录只要修改/etc/vsftpd/vsftpd.conf文件即可: 加入如下几行: local_root=/var/www/html chroot_local_user=YES ano ...

  5. 谈谈我对Promise的理解

    一.Promise是什么? Promise是最早由社区提出和实现的一种解决异步编程的方案,比其他传统的解决方案(回调函数和事件)更合理和更强大. ES6 将其写进了语言标准,统一了用法,原生提供了Pr ...

  6. 浅谈对Jquery+JSON+WebService的使用小结

    https://www.jb51.net/article/36207.htm  更新时间:2013年04月28日 12:19:55   作者:    我要评论   本篇文章介绍了对Jquery+JSO ...

  7. bugku 本地包含

    本地包含 题目信息 地址:http://123.206.87.240:8003/ <?php include "flag.php"; $a = @$_REQUEST['hel ...

  8. kill pkill

    首先说一下kill命令,它是通过pid(进程ID)来杀死进程,要得到某个进程的pid,我们可以使用ps(process status)命令,默认情况下,kill命令发送给进程的终止信号是15,但是有些 ...

  9. leetcode 25. K 个一组翻转链表

    # coding:utf-8 __author__ = "sn" """ 25. K 个一组翻转链表 给你一个链表,每 k 个节点一组进行翻转,请你返 ...

  10. 手动搭建的react环境中,关于图片引入的问题

    react手动搭建的环境,require引进来图片不显示,网页src显示[object module] 解决方案 (1)import引进图片 import anli from './img/anli. ...