• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Need help

hi friends,

I wrote a code for one android application which need audio recording capability.I am using emulator , i cannot record the voice.My system have integrated microphone . Is it possible with emulator for this.

Following is my code.

package com.android.app;

import java.io.IOException;

import android.app.Activity;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Recoder extends Activity
{
public static String path=null;
public static MediaRecorder recoder=null;
Button start=null;
Button stop=null;

public void setPath(String modPath)
{
Recoder.path=modPath;
}

public void onCreate(Bundle b)
{ super.onCreate(b);
setContentView(R.layout.recoder);
this.setPath("/sdcard/myoutputfile.3gp");
start=(Button)findViewById(R.id.btnRecord);
start.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
recoder=new MediaRecorder();
recoder.setAudioSource(MediaRecorder.AudioSource.MIC);
recoder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
recoder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recoder.setOutputFile(Recoder.path);

try
{recoder.prepare();
recoder.start();
}catch(IOException e)
{}

}


});
stop=(Button)findViewById(R.id.btnStop);
stop.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

recoder.stop();
}
}
);

}
}

with regards,

vijeesh kumar:)
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones