How to convert .raw file to .mp3 file when recording complete?

view story

http://stackoverflow.com – I have made a sound Recorder in android. Its functionality is, it first create '.raw' file of the sound which is recorded. Then it convert the '.raw ' file to '.wav' format. But Now i want to convert the '.raw' file in '.mp3' format also. I found the algorithm by which i convert the raw file to wav is following: Samsung Developer RecordingLevelSample.zip file is included in the upper side of the page. (HowTos)