看到了解决方法,但是我曾经工作过,曾经不在线。我不知道是什么。
int resultCode = -1, Intent data = null
拍照,经常搞定。
private void takePicture() {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photoFile = new File(Environment.getExternalStorageDirectory(), StartMenuActivity.DIR_NAME + "/" + travelDirName
+ "/" + travelDirName + "_" + poisArray.size() + ".jpg");
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
imageOrVideoUri = Uri.fromFile(photoFile);
startActivityForResult(cameraIntent, CAMERA_REQUEST_PICTURE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if ((resultCode == RESULT_OK)&&(data != null)) {
if (requestCode == CAMERA_REQUEST_PICTURE) {
createThumbnail();
addPoi(PICTURE_POI);
}
if (requestCode == CAMERA_REQUEST_VIDEO) {
addPoi(VIDEO_POI);
}
// Uri selectedUri = imageOrVideoUri;
// Bitmap photo = (Bitmap) data.getExtras().get("data");
// imageView.setImageBitmap(photo);
} else {
Toast.makeText(TravelMapActivity.this, R.string.poi_add_error, Toast.LENGTH_LONG).show();
}
}
怎么修?谢谢。