在我的代码中,当我取消相机拍摄的图像时......应用程序崩溃并给出您的应用程序已停止的错误..请帮助我如何解决它。如果拍摄的图像是,我希望我的相机返回到我的应用程序取消...这是我的代码:
int take_image=1;
buttonCamera.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view) {
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, take_image);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == take_image) {
//simple data show for user ease
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
imageView2.setImageBitmap(thumbnail);
}
if (requestCode==RESULT_CANCELED){
Intent returnIntent = new Intent();
setResult(RESULT_CANCELED, returnIntent);
}