カメラを開いて画像を撮影しています。ここ は私のコードです:カメラはエミュレータ上のランドスケープビューで開き意図を使用して、カメラを開くときCamera Intentでの画像の取り込み中のAndroidのローテーションの変更
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File
}
// Continue only if the File was successfully created
if (photoFile != null) {
Uri photoURI = FileProvider.getUriForFile(this,
"com.example.android.fileprovider",
photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivity(takePictureIntent);
}
}
}
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath.add(image.getAbsolutePath()) ;
return image;
}
}
今問題があります。ここに画像があります:
The Camera view is open ここで画像を撮った後の様子はどうですか?この段階で
、意味がありません画像は既に切断されたように、画像を回転させる... アイデアAndroidのカメラが正常に... ところで画像が保存されますことを確認する方法について説明します。 ..私のアプリに関係なく、エミュレータ上でカメラアプリを開くと、最初はカメラビューが画面全体をカバーしますが、ボタンをクリックすると画像がカットされます...