Create take Video Intent - Android Intent

Android examples for Intent:Take Video

Description

Create take Video Intent

Demo Code


import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;

public class Main{
    /*from w  w  w  . j a  v a2 s . c  o m*/
    public static final int REQUEST_CODE_TAKE_VIDEO = REQUEST_CODE_TAKE_PHOTO + 1;
    
    public static void takeVideo(Activity activity) {
        Intent intent = takeVideoIntent();
        activity.startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO);
    }
    public static void takeVideo(android.support.v4.app.Fragment fragment) {
        Intent intent = takeVideoIntent();
        fragment.startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO);
    }
    private static Intent takeVideoIntent() {
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
        // ???10s????
        intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
        return intent;
    }
}

Related Tutorials