A problem in the file name with path

Hi all, I’m making an app in which I put the elements of ListWiev1 with files in various formats thanks to the Taifunfile. In practice I am making a sort of archive in which you select the file extension and the elements of the ListWiev are set on the files of that extension which finds the Taifunfile in the device memory. The elements of ListWiev1 will then be set for example to "storage/emulated/0/DCIM/(file name).(extension). The problem is that I would like to remove the “storage/emulated/0/” part from the ListWiev text. How can I do it??

Use these blocks to solve your problems. :wink:

Explanation of how it works:

When we split the string, we get the result in the form of lists. For example, if we split the file with name “storage/emulated/0/DCIM/image1.jpg” , then we will get result as [storage, emulated, 0, DCIM, image1.jpg]. Here in the ListView, we are setting title as select list item-> split text -> file name and we are setting index as the length of list, which will return the last item of the list, which is obviously the file name which you wanted to show. This is how it works.
Hope it will help you. :slight_smile:


Looks like your strategy will remove DCIM, but i think he only thing @Jacopo_Biondi wants to remove is

right, i want to remove “storage/emulated/0/”

Something like this?
or :


check stackflow for this path

This path doesn’t exist.

Should be:


See also here:

1 Like

this was an example u can check it file manager for path where u want to save but pattern is same

If you want to remove only “storage/emulated/0/”, then join two text with index ’length of list-1 & length of list'. Simple. :wink:

Like this:

Thanks for making it clear. I added the solution for that. :slight_smile:

If he will do like this, then he might face error if the folder name changes. :sweat_smile:


Great… it will work well on this case, but you don’t know how many sub-folders will the path have. if /storage/emulated/0/DCIM/subfolder/file.extension
i think we need a procedure that checks the number of sub folders and then makes your code.

Actually there’s an extension available to get sub folders from the device storage.

An extension by @vknow360:

Try it. :wink: