Trouble getting location to recorded audio

by Pich » Sun, 29 Nov 2009 04:21:05 GMT

Sponsored Links

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

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

And the following code to save the location to the newly recorded

Uri uri = data.getData():

And this code to play (it works with no problem):

MediaPlayer mp = new MediaPlayer();

My problem is the following:

1. My filename (fileName) has no effect, the Uri returned from
data.getData() returns in my last test run: 
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.

2. I want to mail this recording using the ACTION_SEND, but I can't
attach the audio file, I guess because soundRecording.getLocation()
points to content://media/external/audio/media/41 and not
File file = new File(soundRecording.getLocation());
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));

Can anyone help me?

Best regards



Other Threads

1. htc sync - does it actually exist?

i have been looking for htc sync online for a while now and am
convinced that it doesn't exist. also i haven't found a way to pay for
applications or get another home software like ahome.

other things on the have not been found list: the lochness monster,
the yeti and levitation.

2. Scaling an image

Hey all!

This has been frustrating me for a while, all I want is to scale an image to
dimensions that I define whilst keeping an aspect ratio. So for example,
image comes in at 500 * 500, I want to scale to 320 * 480 so I need 320 *
320 so as not to distort the image.

This must be a simple 3 lines of code using a matrix? I just can't do it,
it's lame, i'm very tired and it turns out I suck at programming. One of
those days! :)

Any help greatly appreciated, what you have to work with is this;

        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;

        scale = larger of the two scales;

        // createa matrix for the manipulation
        Matrix matrix = new Matrix();
        // resize the bit map
        matrix.postScale(scale, scale);

        // recreate the new Bitmap
        Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,
                          width, height, matrix, true);



3. Android on Ubunty 9.04: redux, connecting your G1

4. Example code of listview/arrayadapter with rows containing multiple text views?

5. Example code of listview/arrayadapter with rows containing multiple text views?

6. How do I export 'sent mail' from default email client?

7. HelloSpinner example runs but gives resource error