0

I created an android photo app in which I capture an image from camera and then draw that bitmap image on canvas in an another activity but sometimes the bitmap image draw on canvas get rotated. How I can resolve this issue ? so that my app work smoothly.

  • 1
    can you please post your code ? – Haresh Chhelana Sep 09 '14 at 06:18
  • In this SO.Q. answers you will get answer too. [Camera Photo Orientation issue](http://stackoverflow.com/questions/6069122/camera-orientation-issue-in-android) – Pravin Sep 09 '14 at 06:26
  • if ( exif != null ) { final int orientation = exif.getAttributeInt( ExifInterface.TAG_ORIENTATION, 1 ); if ( orientation != -1 ) { switch ( orientation ) { case ExifInterface.ORIENTATION_UNDEFINED: degree=90; break; case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270; break; } } } return degree; } – user3706375 Sep 09 '14 at 09:36
  • here I use this method – user3706375 Sep 09 '14 at 09:39
  • int oreintation=ex.getExifOrientation(imagepath); try { ExifInterface exif=new ExifInterface(imagepath); degree=ex.getExifOrientation(exif); } catch(Exception e) { System.out.println(e); } Matrix matrix =new Matrix(); //refresh_btn=(ImageView)findViewById(R.id.refresh_view); if(globalVariable.refresh==true) { degree=270; globalVariable.refresh=false; } matrix.postRotate(degree); – user3706375 Sep 09 '14 at 09:39

0 Answers0