我在三星設備上的圖像有問題 每次我拍一張照片的垂直形式,但是當它調用圖像庫時,教室 垂直 它用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方法我怎樣才能使形象展示我垂直在個人資料照片?
能否請您使用短語,如「畫像」和而不是「垂直」景觀'。你的問題不清楚。你能否請你審查並改變它,因爲你說你想要垂直顯示圖像,你的評論說它已經顯示垂直。 –