ok i have myself solved my problem after a little R&D and posting the solution here so that it could help somebody like me....
//getting path for storage
File audioFile = context.getCacheDir();
OUTPUT_FILE =audioFile.getPath()+"/"+"myAudioFile.3gp";
//Function for Recoding Voice
private void startRecording() throws IllegalStateException, IOException{
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(OUTPUT_FILE);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
recorder.prepare();
} catch (IOException e) {
Log.e("development", "prepare() failed");
}
recorder.start();
}