Question

i'm trying to create an app that allows voice recording. i hope to call the default voice recorder app just like how i call the camera app. what i wanted is my app will intent/call the default app. after recording, it will return immediately to my app (just like what happen when i call for the camera)

the code that i used for calling the camera :

Intent takePictureFromCameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

is there anyway that is close to the code above, where its simple and also achieved what i wanted ?

Was it helpful?

Solution

Try this,

Intent recordIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(recordIntent, RESULT_OK);

And onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
  if (resultCode == Activity.RESULT_OK)
  {
    String theFilePath = data.getData().toString();
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top