The Android Dev has some easy code describing how to start the camcorder via Intents.
Now this is good if you just want to start up the camera and wait for the user to press the red "REC" button.
But I want to call the camcorder via Intent and tell it to start recording programmatically.
How to I do that? Do I pass some kind of start() method in the Intent command?
(if it can't be done, please show me a simple code bit that can be set up to record video automatically - I have been searching the web, but all codesnippets regarding this issue don't work)
private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100;
private Uri fileUri;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// create Intent to take a picture and return control to the calling application
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
// start the image capture Intent
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
For this you should use MediaRecorder
class.
Please have a look at this :
http://developer.android.com/reference/android/media/MediaRecorder.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With