如何从URI获取文件名文件名、URI

2023-09-07 11:54:50 作者:- 泪雨、错觉 ゐ

您好 我开发的视频播放器与Android画廊。 我收到的URI从gallry。我需要显示视频节目,当播放视频。 因此,如果内容没有标题的元数据。我需要disaplay视频文件名。 如何获得视频内容的文件名?

Hello I am develop video player with android gallery. I receive URI from gallry. and I need to display video title, when play video. so if content has not title meta data. I need to disaplay video file name. How to get video content file name?

谢谢

推荐答案

下面是code从URL获取文件名

Here is the code for getting name of file from url

Uri u = Uri.parse("www.google.com/images/image.jpg");

File f = new File("" + u);

f.getName();