/**
* 启动系统相机
*
* @param view
*/
public void takePhoto(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CASE_CAMERA);
}
拍完成照后的回调函数如下:
/**
* 拍照后的回调函数
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
try {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == CASE_CAMERA) {
Bundle extras = data.getExtras();
//获取图片信息
Bitmap bitmap = (Bitmap) extras.get("data");
//保存图片
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ "/tmp";
saveImage(bitmap,path);
}
}
} catch (Exception e) {