Ripei
Ripei

Reputation: 432

Android Intent Save Path

At the moment I am using two intents. One for voice-recording, another for the camera:

Intent photoIntent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(photoIntent, ACTIVITY_TAKE_PHOTO);

Intent voiceIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(voiceIntent, ACTIVITY_RECORD_SOUND);

My aim is to put an Extra to each of those which contains the path where to store the picture / the recorded Voice. Is there an option to do so?

Upvotes: 0

Views: 4810

Answers (3)

Roman Nurik
Roman Nurik

Reputation: 29745

You can use the EXTRA_OUTPUT extra to specify a destination Uri for images taken with ACTION_IMAGE_CAPTURE (but not RECORD_SOUND_ACTION; for that, the returned bundle will contain the file path).

An example can be found here, excerpt below:

Loosely quoting yanokwa:

// fire off the intent
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
           Uri.fromFile(new File("<temp file path here>")));
startActivityForResult(i, mRequestCode);

BTW, a similar question can be found here.

Upvotes: 2

Donn Felker
Donn Felker

Reputation: 9651

AFAIK this is not possible from firing off Intents.

When the given activity returns the picture/voice data should be in the result. Take that data and then save it from within your activity to your desired location. The camera/recorder activity simply handles pictures/audio and then returns the result back to you to handle.

Upvotes: 0

CaseyB
CaseyB

Reputation: 25058

I am not sure but my first thought would be to set the data uri of the intent and see if that does anything.

Upvotes: 0

Related Questions