Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim gsdirapp As String
gsdirapp=File.DirRootExternal & "/" & "directorio_App"
Dim gsdirjpg As String
gsdirjpg=gsdirapp & "/subdirectorio_jpgs/"
Private ImageView1 As ImageView
Dim bitmapOriginal As Bitmap
Dim bitmapRotated As Bitmap
Dim exifdataInstance As ExifData
Dim booleanNeedToWriteRotatedBitmap,booleanError As Boolean
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
GetRotatedBitmap
End Sub
Sub GetRotatedBitmap As Bitmap
Dim bitmapOriginal As Bitmap
Dim bitmapRotated As Bitmap
Dim exifdataInstance As ExifData
Try
booleanNeedToWriteRotatedBitmap = False
exifdataInstance.Initialize (gsdirjpg, "nombre_imagen.jpg")
bitmapOriginal.Initialize (gsdirjpg, "nombre_imagen.jpg")
Select Case exifdataInstance.getAttribute (exifdataInstance.TAG_ORIENTATION)
Case exifdataInstance.ORIENTATION_ROTATE_90
bitmapRotated = bitmapOriginal.rotate (90)
Case exifdataInstance.ORIENTATION_ROTATE_180
bitmapRotated = bitmapOriginal.rotate (180)
Case exifdataInstance.ORIENTATION_ROTATE_270
bitmapRotated = bitmapOriginal.rotate (270)
Case Else
Return bitmapOriginal
End Select
booleanNeedToWriteRotatedBitmap = True
ImageView1.Bitmap=LoadBitmapSample(gsdirjpg,bitmapRotated,100%x,100%y)
Return bitmapRotated
Catch
booleanError = True
Return Null
End Try
End Sub