Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.Intent;

import android.net.Uri;

import android.provider.MediaStore;

public class Main {
    public static Intent buildVideoIntent(Context context, Uri uri) {

        String title = "Choose photo";

        //Build galleryIntent
        Intent galleryIntent = new Intent(Intent.ACTION_PICK);

        galleryIntent.setType("video/*");
        //Create chooser
        Intent chooser = Intent.createChooser(galleryIntent, title);

        Intent cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
        Intent[] extraIntents = { cameraIntent };
        chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents);
        return chooser;

    }
}