我想使用默认相机并捕获图像。我想将图像保存在 sdcard/photofolder/ 中,并将文件名保存为 sdcard/photofolder/ 中的当前时间格式,还在 imageview 页面中显示捕获图像
Uri outputFileUri = Uri.fromFile("/sdcard/Photofolder/");
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, CAMERA_REQUEST);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
// imageView.setImageBitmap(photo);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
Bitmap bitmap = BitmapFactory.decodeFile(picFileName, options);
imageView.setImageBitmap(bitmap);
imageView.setVisibility(View.VISIBLE);
}
}
有什么想法吗?提前感谢