Trouble getting location to recorded audio

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


Sponsored Links
 Hi,

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);


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

Uri uri = data.getData():
soundRecording.setLocation(uri.toString());

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

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(soundRecording.getLocation());
mp.prepare();
mp.start();


My problem is the following:

1. 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.

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
recording34485.3gpp:
File file = new File(soundRecording.getLocation());
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));

Can anyone help me?

Best regards

Pich

--



Other Threads

1. Show background applications dialog in front of current application

Interrupting another application with a custom dialog sounds quite invasive
to the user. How about displaying a notification icon when you want the user
input?

Sean






--~--~---------~--~----~------------~-------~--~----~

2. Building Android Source

Hi all,
I've been having trouble building the Android source on my Debian
Lenny box. The tail of the build log is as follows:

external/qemu/skins/skin_window.c: In function
`skin_window_trackball_press':
external/qemu/skins/skin_window.c:964: warning: implicit declaration
of function `send_key_event'
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/
skins/skin_window.o] Error 1

I've ensured I have all the relevant libraries from the install page,
and I've tried checking all the source out from Repo a second time..
No luck!

Any ideas?

I've posted the build log in its entirety at this address:
http://mafro.net/build.log.tar.gz

Incidentally, I've been messing about building some C programs using
the CodeSourcery cross compiler, and wanted to try using Android's own
toolchain. The details for this I read here:
http://android-tricks.blogspot.com/

Thanks for any and all assistance!
mafro

--~--~---------~--~----~------------~-------~--~----~

3. hello world

4. How to launch installed app from adb shell

5. Is there no TCK (Technology Compatibility Kit) on Android????

6. How to customize Android SDk kernel

7. how can I create a 'View' object from a xml file?