How to extract the file name from URI returned from Intent.ACTION_GET_CONTENT?

后端 未结 17 2083
梦如初夏
梦如初夏 2020-11-28 05:09

I am using 3rd party file manager to pick a file (PDF in my case) from the file system.

This is how I launch the activity:

Intent i         


        
17条回答
  •  无人及你
    2020-11-28 05:47

    If you want it short this should work.

    Uri uri= data.getData();
    File file= new File(uri.getPath());
    file.getName();
    

提交回复
热议问题