I got some uri, that looks something like this content://media/internal/audio/media/48 I got it from intent, but I want to get the file name of the file it point to. How can I do this ?
I found the solution
Ringtone r=RingtoneManager.getRingtone(this, uri);
and than the name is taken like this
r.getTitle(this));
If I understood you right, I would try create a new File object with File aFile = new File(uri) and then call getName() on aFile.
edit: or try it like this:
File aFile = new File(uri);
if(aFile.isDirectory())
{
aFile.list()
}
else
{
aFile.getName()
}
list() would give you a stringarray of the contained files...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With