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

  • SEARCH
  • Home
  • 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 9125503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:49:09+00:00 2026-06-17T06:49:09+00:00

I am quite new to programming and I would like to learn how to

  • 0

I am quite new to programming and I would like to learn how to do an app that allows user to record the audio and hence, save it into the app’s data folder. I managed to do the recording part but only managed to save it into the sd card.. Anybody willing to help me figure out how to save my audio into an internal storage??

private void playRecording() throws Exception {
    ditchMediaPlayer();
    mediaPlayer = new MediaPlayer();
    mediaPlayer.setDataSource(OUTPUT_FILE);
    mediaPlayer.prepare();
    mediaPlayer.start();
}

private void stopRecording() {
    if(recorder != null)
        recorder.stop();
}

private void beginRecording() throws Exception {
    ditchMediaRecorder();
    File outFile = new File(OUTPUT_FILE);

    if(outFile.exists())
        outFile.delete();

    recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setOutputFile(OUTPUT_FILE);

    recorder.prepare();
    recorder.start();

}

private void ditchMediaRecorder() {
    if (recorder != null)
        recorder.release();
}

  public void recordOnClick(View v) {
      //when record button is pressed
      try{
            beginRecording();
        }catch (Exception e){
            e.printStackTrace();
        }
        btnRecord.setVisibility(View.INVISIBLE);
        btnStop.setVisibility(View.VISIBLE);
  }

  public void stopOnClick(View v) {
      //when stop button is pressed
      try{
            stopRecording();
        }
        catch (Exception e){
            e.printStackTrace();
        }

        btnStop.setVisibility(View.INVISIBLE);
        btnRecord.setVisibility(View.INVISIBLE);

        btnDelete.setVisibility(View.VISIBLE);
        btnPlay.setVisibility(View.VISIBLE);
        btnShare.setVisibility(View.VISIBLE);
  }

  public void playOnClick(View v) {
      //when play button is pressed
        try{
            playRecording();
        }
        catch (Exception e){
            e.printStackTrace();
        }

        btnStop.setVisibility(View.INVISIBLE);
        btnRecord.setVisibility(View.INVISIBLE);
  }

And this is my onClick where I will specify my output per button (im doing a chart so I have around 44 buttons!)

    public void onClick(View v) {
switch (v.getId()) {

case R.id.btn1:

      OUTPUT_FILE=Environment.getExternalStorageDirectory()+"/y1.3gpp";     
  File file1 = new File(Environment.getExternalStorageDirectory()+"/y1.3gpp");
        if (file1.exists()) {

            btnPlay.setVisibility(View.VISIBLE);
            btnDelete.setVisibility(View.VISIBLE);
            btnShare.setVisibility(View.VISIBLE);
        }
        else {
            btnRecord.setVisibility(View.VISIBLE);
        }   
 break;

case R.id.btn2:

OUTPUT_FILE=Environment.getExternalStorageDirectory()+"/y2.3gpp";   
File file2 = new File(Environment.getExternalStorageDirectory()+ "/y2.3gpp" );
        if (file2.exists()) {

            btnPlay.setVisibility(View.VISIBLE);
            btnDelete.setVisibility(View.VISIBLE);
            btnShare.setVisibility(View.VISIBLE);
        }
        else {
            btnRecord.setVisibility(View.VISIBLE);
        }   

 break;
  • 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-17T06:49:10+00:00Added an answer on June 17, 2026 at 6:49 am

    maybe you would want to take a look at this? Creating folder in internal Memory to save files and retrieve them later

    //Creating an internal directory
    File mydir = context.getDir("mydir", Context.MODE_PRIVATE); 
    //Getting a file within the dir.
    File fileWithinMyDir = new File(mydir, "myfile"); 
    FileOutputStream out = new FileOutputStream(fileWithinMyDir); 
    //Use the stream as usual to write    into the file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm quite new to that functional programming paradigm, but so far I like it.
I am quite new to Maven and Java EE programming all-together. I would like
Iam quite new to functions in SQL and I would like to create a
I have been programming with .NET 2.0 version for quite sometime and would like
I am new to programming in general so I decided that I would start
I'm quite new to programming. I have an ASP.NET 4.0 application and I would
I am quite new to programming, i have a question please help me. (
I am quite new to SQLAlchemy, or even database programming, maybe my question is
I've been programming OpenGL for some time now but I'm quite new to OpenGL
Scenario: Quite new to DI and Ninject but would love to master it so

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.