Overwriting the file usually won't actually overwrite it, it just saves the new file, repoints the directory entry to it, then marks the old file as being deleted. If you haven't written anything that would actually overwrite it - and the old file was on your SD card (you can't "recover" an "overwritten" file that's stored in internal storage) - you can run
PhotoRec on the card (instructions at
PhotoRec Step By Step) - it recovers files whether they're linked or unlinked to any directory.
Stored on internal storage? Only manually and, although I've been writing software for 45 years, and actually had to manually recover deleted blocks of data from storage, I'd be a multi-millionaire if I took a job like that now. That's about the only thing that could tempt me to be that masochistic. (And even in an 8GB phone, it would probably take months.)