Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6773419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:39:58+00:00 2026-05-26T15:39:58+00:00

I’m trying to record sound using Android Emulator. I know that this question is

  • 0

I’m trying to record sound using Android Emulator. I know that this question is popular over the internet, I checked many posts, it seems that only one person succeded: Can the Android emulator record and play back audio using pc hardware?. (it think he used

File fTmFile; insteadof String fTmpFile;

which i also tried). And following Philip’s advice and the official site tutorial http://developer.android.com/guide/topics/media/audio-capture.html and also other resources, I’m still not able to record. My application throws exception at line:

fMediaRecorder.prepare(); 

more exactley, this is what I first get:

W/System.err(1042): java.io.FileNotFoundException: /mnt/sdcard/audiorecordtest.3gp (Permission denied)

which makes me think is something wrong with the storage location, because even I added ‘SD Card Support’ property for the emulator with size 256 MiB, I’m not able to acces it, furthermore I can see in the emulator the message: “Your phone does not have a SD Card inserted” when I go to Music.

I added both audio record and external storage permissions, in AndroidManifest.xml and both audio (record+playback) hardware settings to the emulator 2.3.3 on Win 7. Is anything wrong within my app, the way I storage the file or something else? Please, if anybody has any idea feel free to share, it will be appreciated.

Here is the full source code:

import java.io.File;
import java.io.FileDescriptor;
import java.io.IOException;
import android.app.Activity;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class RecordSoundActivity extends Activity {

  private MediaRecorder fMediaRecorder = null;
  private Button btnrecord;
  private Button btnstop;
  String fTmpFile;

  public RecordSoundActivity() {

    fTmpFile = Environment.getExternalStorageDirectory().getPath();
    fTmpFile += "/audiorecordtest.3gp";
  }

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    btnrecord = (Button) findViewById(R.id.button1);
    btnstop = (Button) findViewById(R.id.button2);

    btnrecord.setOnClickListener(new View.OnClickListener() {

      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        Toast.makeText(RecordSoundActivity.this, "Recording...", Toast.LENGTH_LONG).show();
        Recording();
      }
    });

    btnstop.setOnClickListener(new View.OnClickListener() {

      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        fMediaRecorder.stop();
        fMediaRecorder.release();
      }
    });
  }

  public void Recording() {
    fMediaRecorder = new MediaRecorder();
    fMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    fMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    fMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

    fMediaRecorder.setAudioChannels(1);
    fMediaRecorder.setAudioSamplingRate(8000);

    fMediaRecorder.setOutputFile(fTmpFile);

    try {
      fMediaRecorder.prepare();
    } catch (IOException e) {
      // TODO: handle exception
      e.printStackTrace();
    }
    try {
      fMediaRecorder.start();
    } catch (IllegalStateException e) {
      // TODO: handle exception
      e.printStackTrace();
    }

    //fMediaRecorder.stop();
    //fMediaRecorder.release();
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:39:59+00:00Added an answer on May 26, 2026 at 3:39 pm

    Try and see if it works for Android 4.0. I know I had some issues with the camera in the emulator, in lower version (Lower than 4.0) it just wouldn’t recognize my laptop webcam. But when I tried it on 4.0, when the AVD was loading a popup message came and asked me if I want to connect the webcam to the AVD, and once I agreed it worked.

    Another poster in SO asked this question too, about the camera, and changing the AVD version to 4.0 did help him.

    Maybe its the same for audio recording too, as both are external hardware for the typical PC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.