1. Check out our companion app, Forums for Android! Download from Google Play

Need help

Discussion in 'Introductions' started by vijeeshin, Nov 19, 2010.

  1. vijeeshin

    vijeeshin New Member
    Thread Starter
    25

    Nov 19, 2010
    2
    0
    25
    junior software developer
    mavelikara
    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:)
     

    Advertisement

  2. Martimus

    Martimus One bite at a time...
    843

    Jul 9, 2010
    19,535
    4,045
    843
    Male
    Engineer
    'neath a cactus
  3. Steven58

    Steven58 Reformed PH
    3,933

    Feb 19, 2010
    32,948
    25,335
    3,933
    Male
    Welcome to Android Forums! Glad you signed up!
     
    vijeeshin likes this.
  4. vijeeshin

    vijeeshin New Member
    Thread Starter
    25

    Nov 19, 2010
    2
    0
    25
    junior software developer
    mavelikara
    Provide me more links which help me to do this
     

Share This Page

Loading...