我需要捕捉图像并在Image View
这就是我所做的;
btnLaunchCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
activeTakePhoto();
}
});
private void activeTakePhoto() {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(Environment.getExternalStorageDirectory(), FILE_NAME);
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, 119);
}
当我按OK
时,它会显示图像视图,这是我在图像视图中显示图片的方法。
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
selectedImage = imageUri;
Intent intent= new Intent(CameraLauncherActivity.this, MainActivity.class);
intent.putExtra("imageBitmap", selectedImage);
startActivity(intent);
}
MainActivity
imageUri= (Uri) intentData.getExtras().get("imageBitmap");
mImageView.setImageURI(imageUri);