Why Images are rotated 90 degree in ImageView?
<p>Why images are rotated 90 degree in imageView?? and how to fix it??</p>

<p>All images in gallery are not rotated 90 degree in imageView.</p>

<p>I don't know why some images are rotated 90 degree in imageView.</p>

<pre><code>@Override
protected void onActivityResult(int requestCode , int resultCode , Intent data){
    if(requestCode == 100){
        if(resultCode == Activity.RESULT_OK){
            try{
                ImageView imageView = (ImageView)View.inflate(this, R.layout.imagelayout, null);
                Uri imgUri = data.getData();

             Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imgUri);
                int height = bitmap.getHeight();
                int width = bitmap.getWidth();
                int newHeight = height;
                int newWidth = width;
                float rate = 0.0f;

                if(width &gt; height ){
                    if(imageFlipper.getWidth() &lt; width ){
                        rate = imageFlipper.getWidth() / (float) width ;
                        newHeight = (int) (height * rate);
                        newWidth = imageFlipper.getWidth();
                    }
                }else{
                    if(imageFlipper.getHeight() &lt; height ){
                        rate = imageFlipper.getHeight() / (float) height ;
                        newWidth = (int) (width * rate);
                        newHeight = imageFlipper.getHeight();
                    }
                }


              Bitmap reSize = Bitmap.createScaledBitmap(bitmap , newWidth , newHeight,true);

              imageView.setImageBitmap(reSize);

              //imageView.setImageURI(imgUri);
                imageFlipper.addView(imageView);
                imageFlipper.setDisplayedChild(imageFlipper.getChildCount() - 1);

            }catch(Exception e){
                e.printStackTrace();
            }
        }
    }
}
</code></pre>