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;

import java.io.File;

public class Main {
    public static final int BBS_REQUEST_CAMERA = 2;

    public static void takePicture(Activity mActivity, String imagePath) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (null != imagePath && !imagePath.isEmpty()) {
            intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(imagePath)));
        }
        mActivity.startActivityForResult(intent, BBS_REQUEST_CAMERA);
    }
}