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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:26:04+00:00 2026-05-26T06:26:04+00:00

I have to following code to launch and the audio recorder on Android: final

  • 0

I have to following code to launch and the audio recorder on Android:

final Intent recordSoundIntent = new Intent
("android.provider.MediaStore.RECORD_SOUND");
String fileName = Environment.getExternalStorageDirectory() +
File.separator + UUID.randomUUID() + ".3gpp";
recordSoundIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new
File(fileName)));
startActivityForResult(Intent.createChooser(recordSoundIntent,
getString(R.string.record_sound_chooser)), INTENT_SOUND_RECORDING);

My problem is the following:

My filename (fileName) has no effect, the Uri returned from
data.getData() returns in my last test run: content://media/external/audio/media/41.
However, this file is created on my sdcard: recording34485.3gpp. If it
is not possible to set custom location upon creating sound it is the
location to this file I would like.

  • 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-26T06:26:05+00:00Added an answer on May 26, 2026 at 6:26 am

    Was working on the same problem. Could not find a way to set location directly but found a work around solution of getting and renaming it.

    Getting file name was dealt with here, file is then renamed using java.io.File.renameTo(). You’ll need android.permission.WRITE_EXTERNAL_STORAGE in your manifest file for the rename to work.

    Here is my test code example:

    public static final int REQUEST_RECORD_SOUND = 7;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
    
        Button button = (Button) findViewById(R.id.button1);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent intent  = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
                startActivityForResult(intent, REQUEST_RECORD_SOUND);
            }
        });
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
    
        if (requestCode == REQUEST_RECORD_SOUND){
            String sourcePath = getRealPathFromURI(intent.getData());
            File root = Environment.getExternalStorageDirectory();
            String destPath = root.getPath() + File.separator + "newName.txt";
            File sourceF = new File(sourcePath);
            try {
                sourceF.renameTo(new File(destPath));
            } catch (Exception e) {
                Toast.makeText(this, "Error:" + e.getMessage(), Toast.LENGTH_LONG).show();
            }
        }
    }
    
    /**
     * from:
     * https://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore
     */
    public String getRealPathFromURI(Uri contentUri) {
        String[] proj = { MediaStore.Images.Media.DATA };
        Cursor cursor = managedQuery(contentUri, proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Intent myIntent = new Intent(Intent.ACTION_VIEW, ContentURI.create(arAdapter.getItem(position).getUrl())); startActivity(myIntent); But I
I have the following C# code to launch an outlook window. The one think
I have following code class User attr_accessor :name end u = User.new u.name =
I have the following code to launch a dilog, do ajax and populate it
I have following code Ext.regModel('Centre', { fields: ['name', 'url'] }); Ext.application({ name: 'Sencha', launch:
I have the following code: var psi = new ProcessStartInfo(); psi.FileName = @C:\gw\gw.exe; psi.WorkingDirectory=@C:\gw;
I have quick question. I am using the following code to launch camera and
I have a .plist created at the application launch with the following code (MyAppTableViewController):
I have the following lines of code: xslt.Load(XmlReader.Create(new FileStream(@C:\website\TransList.xslt, System.IO.FileMode.Open))); xslt.Transform(mydoc.CreateReader(),null, sw); It works
I have the following html code : <a href=http://google.com/ title=Google rel=gb_page_center[500, 500]>Launch</a> It launches

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.