Need help


Last Updated:

  1. vijeeshin

    vijeeshin New Member This Topic's Starter

    Joined:
    Nov 19, 2010
    Messages:
    2
    Likes Received:
    0
    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... Moderator

    Joined:
    Jul 9, 2010
    Messages:
    19,535
    Likes Received:
    4,045
  3. Steven58

    Steven58 Reformed PH VIP Member

    Joined:
    Feb 19, 2010
    Messages:
    32,920
    Likes Received:
    25,271
    Welcome to Android Forums! Glad you signed up!
     
    vijeeshin likes this.
  4. vijeeshin

    vijeeshin New Member This Topic's Starter

    Joined:
    Nov 19, 2010
    Messages:
    2
    Likes Received:
    0
    Provide me more links which help me to do this
     

Share This Page

Loading...