Anusha B Anusha B - 6 months ago 46
Android Question

How to get only audio and video name without the .mp3 and .mp4 extention in android

I have audio and video names like this :

azan1(1).mp3 and Funny.mp4

So I need an only AudioName as azan and VideoName as Funny. Need to replace .mp3 and .mp4 from the string how can I achieve this in code.??

Answer Source

Try this way to get filename without extension:-

if (fileName.indexOf(".") > 0)
   fileName = fileName.substring(0, fileName.lastIndexOf("."));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download