我正在使用 thttp://developer.android.com/training/camera/photobasics.html 的谷歌文档来允许我的应用程序捕获图片。当我刚刚调出相机时,该应用程序运行良好。当我添加代码来捕获图像时,它会崩溃,然后相机应用程序就会运行。
这是代码
public void onClick(View v){
super.onClick(v);
Intent i;
Intent browserIntent;
switch(v.getId()){
case R.id.butTakePhoto:
// call the camera
Intent takePictureIntent =
new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent, 1);
// capture image from camera
// this code causes it to crash
Bundle extras = takePictureIntent.getExtras();
Bitmap mImageBitmap = (Bitmap) extras.get("data");
mImageView.setImageBitmap(mImageBitmap);
break;
}
}