我在三星设备上的图像有问题 每次我拍一张照片的垂直形式,但是当它调用图像库时,教室 垂直 它用ExifInterface类我无法找到导致imageView中的照片方向与三星手机
我每次拍照我打电话给我的类PreviewImage这是我显示出图像 后来我有带我到指定的个人资料照片我有这个方法的按钮onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) {
try {
ExifInterface exifInterface = new ExifInterface(photoFile.getAbsolutePath());
int exif = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (exif) {
case ExifInterface.ORIENTATION_ROTATE_90:
orientation = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
orientation = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
orientation = 270;
break;
}
} catch (Exception e) {
Log.d("tmessages", e.toString());
}
Intent intent = new Intent(this, PhotoViewer.class);
intent.putExtra(EXTRA_PHOTO_PATH, photoFile.getAbsolutePath());
intent.putExtra(EXTRA_PHOTO_ORIENTATION, orientation);
intent.putExtra(EXTRA_PHOTO_EDIT, false);
startActivityForResult(intent, 10);
}
这是我PhotoViewer类
private void sendPicture() {
Intent returnIntent = new Intent();
returnIntent.putExtra("photoDescription", photoDescription.getText().toString());
returnIntent.putExtra("photoPath", localPath);
returnIntent.putExtra("orientation", orientation);
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
一旦拍摄完成返回我的个人资料类从那里它被称为
else if (requestCode == 10 && resultCode == Activity.RESULT_OK) {
if (photoFile != null&&LoginController.getInstance().xmppConnection.isConnected()) {
byte[] photo = AndroidUtilities
.createProfileImage(photoFile.getAbsolutePath());
ProfileManager.getInstance().publishPhoto(photo);
Bitmap decodedByte = BitmapFactory.decodeByteArray(photo, 0, photo.length);
avatar.setImageBitmap(decodedByte);
}else{
Toast.makeText(this,R.string.LabelProfilePhotoFailed, Toast.LENGTH_SHORT).show();
}
}
的onActivityResult方法我怎样才能使形象展示我垂直在个人资料照片?
能否请您使用短语,如“画像”和而不是“垂直”景观'。你的问题不清楚。你能否请你审查并改变它,因为你说你想要垂直显示图像,你的评论说它已经显示垂直。 –