Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

import android.provider.MediaStore;

public class Main {

    public static void getPhotoFromCamera(Activity context, int requestCode, Uri imageUri) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); // set the image file name
        context.startActivityForResult(intent, requestCode);
    }
}