How to get file name from file path in android

后端 未结 10 2572
清歌不尽
清歌不尽 2020-12-08 06:13

I want to get file name from sdcard file path. e.g. :/storage/sdcard0/DCIM/Camera/1414240995236.jpg I want get 1414240995236.jpg I have written the code to fe

10条回答
  •  再見小時候
    2020-12-08 06:46

    Simple and easy way to get File name

    File file = new File("/storage/sdcard0/DCIM/Camera/1414240995236.jpg"); 
    String strFileName = file.getName();
    

    After add this code and print strFileName you will get strFileName = 1414240995236.jpg

提交回复
热议问题