I was using the following code to set the captured image to imageview. When the image captured in landscape view it shows in landscape view but when the image captured in portrait view it also shown in landscape view.
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1 && resultCode == Activity.RESULT_OK){
try {
Bitmap thumbnail = MediaStore.Images.Media.getBitmap(
getContext().getContentResolver(), imageUri);
img_document.setImageBitmap(thumbnail);
} catch (Exception e) {
e.printStackTrace();
}
}
}