- /**
- * 照相功能
- */
- private void cameraMethod() {
- Intent imageCaptureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
- strImgPath = Environment.getExternalStorageDirectory().toString() + "/CONSDCGMPIC/";//存放照片的文件夹
- String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".jpg";//照片命名
- File out = new File(strImgPath);
- if (!out.exists()) {
- out.mkdirs();
- }
- out = new File(strImgPath, fileName);
- strImgPath = strImgPath + fileName;//该照片的绝对路径
- Uri uri = Uri.fromFile(out);
- imageCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
- imageCaptureIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
- startActivityForResult(imageCaptureIntent, RESULT_CAPTURE_IMAGE);
-
- }
复制代码 |
|