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 9251469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:42:24+00:00 2026-06-18T10:42:24+00:00

i am saving some voice recording through mediaplayer: private void startrecording() { audiofile =

  • 0

i am saving some voice recording through mediaplayer:

private void startrecording() {

        audiofile = getAudiofile();
        if (audiofile != null)
            myaudiorecoreder = new MediaRecorder();
        myaudiorecoreder.setAudioSource(MediaRecorder.AudioSource.MIC);
        myaudiorecoreder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        myaudiorecoreder.setOutputFile(audiofile.getAbsolutePath());
        myaudiorecoreder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
        try {
            myaudiorecoreder.prepare();
            setRecordstatus(true);

        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        myrecordtextview.setText("RECORDING STARTED..SPEAK NOW");
        myaudiorecoreder.start();

//
where audiofile will give the sound file.
here is the code for getAudiofile() from which i am getting the file(empty).
//

private File getAudiofile() {
        String extState = Environment.getExternalStorageState();
        if (extState.equals(Environment.MEDIA_MOUNTED)) {
            File mediaStorageDir = new File(
                    Environment.getExternalStorageDirectory() + "/TAUKY/AUDIO");
            if (!mediaStorageDir.exists()) {
                if (!mediaStorageDir.mkdirs()) {
                    Log.e("SDCARD", "failed to create directory");
                    Toast.makeText(getApplicationContext(),
                            "FAILED TO CREATE DIR", 0).show();
                    return null;
                }
            }
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
                    .format(new Date());
            mediaFile = new File(mediaStorageDir.getPath() + File.separator
                    + "SOUND_" + timeStamp + ".mp3");
            // Toast.makeText(getApplicationContext(), "FILE CREATION DONE",
            // 0).show();

        } else {
            Toast.makeText(getApplicationContext(), "NO SDCARD", 0).show();
        }
        return mediaFile;
    }

now on the next activity how to retrieve from the specific folder of the sdcard i.e /TAUKY/AUDIO
Thanks

  • 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-06-18T10:42:25+00:00Added an answer on June 18, 2026 at 10:42 am

    Your question is not very clear but if you want to play the file after saving it in the sdcard you can do something like that since you know the path to your file.

    FileDescriptor fd = null;
    File baseDir = Environment.getExternalStorageDirectory();
    String audioPath = baseDir.getAbsolutePath() + /TAUKY/AUDIO/SOUND_ + timeStamp + ".mp3";
    FileInputStream fis = new FileInputStream(audioPath);
    fd = fis.getFD();
    
    MediaPlayer mediaPlayer = new MediaPlayer();
    mediaPlayer.setDataSource(fd);
    mediaPlayer.prepare();
    mediaPlayer.start();
    

    I’m not 100% sure since i couldn’t test it but it should be something like that. Hope this helps.

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

Sidebar

Related Questions

I'm contemplating adding a voice recording to some posts on my site. I'm wondering
I am saving some files in document directory through my app using custom naming
I'm saving some data through the URL and one of these data elements is
My app is saving some images on the SD Card, in the AppImages directory
I am saving some emails on my local machine using MailBee.NET Objects in htm
My android application is saving some stats to internal storage. Each file name is
I am saving some pictures on the SD card in this way: File dir
I have a action class for saving some data to a database.In action class
I have created a web service which is saving some data into to db.
I'm getting some data from the web service and saving it in the core

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.