Ich habe ein Problem mit dem Bild auf dem Samsung-Gerät Jedes Mal, wenn ich ein Foto, das die vertikale Form, aber wenn es ein Bild der Galerie die Klasse ruft Vertically es mit Klasse ExifInterface programmiert und ich kann nicht dazu führen, findenFoto Orientierung in Imageview mit Samsung Handy
Jedes Mal, wenn ich ein Bild, das ich meine Klasse PreviewImage nennen, das ist, wo ich das Bild zeigen Anschließend habe ich den Knopf, der mich nimmt das Profil Foto zuweisen ich diese Methode haben 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);
}
Und das ist meine PhotoViewers Klasse
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();
}
Sobald das Foto aufgenommen wird es wieder mich zur onActivityResult Methode der Profilklasse, von wo es
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();
}
}
hieß Wie kann ich die Bild Show machen ich vertikal im Profilfoto?
Können Sie bitte Ausdrücke wie "Porträt" und "Landschaft" anstelle von "vertikal" verwenden. Deine Frage ist nicht klar. Können Sie es bitte überprüfen und ändern, während Sie sagen, dass Sie das Bild vertikal zeigen möchten, sagt Ihr Kommentar, dass es bereits vertikal angezeigt wird. –