AdvancedCamera library

upsis

Member
Licensed User
Longtime User
I am using a ACL and when camera is ready to take picture, the image in panel appears rotate 90 degrees, What could be? My code is exactly equal example supllied with library, except size of panel.
 

upsis

Member
Licensed User
Longtime User
'Activity module
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 camera1 As AdvancedCamera
Dim btnTiraFoto As Button
Dim pnlFoto As Panel
Dim boolSalvouColeta As Boolean : boolSalvouColeta=False
Dim strNomeArqFoto As String
Dim lblFoto As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Fotos")
lblFoto.Text=Main.gstrFoto
btnTiraFoto.Enabled = True
End Sub

Sub Activity_Resume
btnTiraFoto.Enabled = False
camera1.Initialize(pnlFoto, "Camera1")

End Sub

Sub Activity_Pause (UserClosed As Boolean)
camera1.StopPreview
camera1.Release
End Sub
Sub btnTiraFoto_Click
btnTiraFoto.Enabled = False
camera1.Quality=50
camera1.PictureSize(320,240)
camera1.TakePicture
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
btnTiraFoto.Enabled = True
Else
ToastMessageShow("Não conseguiu abrir a câmera", True)
End If
End Sub
Sub Camera1_PictureTaken (data() As Byte)
camera1.StartPreview
Dim out As OutputStream
Dim dtHoje As Long : dtHoje = DateTime.Now

strNomeArqFoto = Main.gstrNomeCliExec.SubString2(0,10) & "-" & Main.gstrFoto & "-" & _
DateTime.GetDayOfMonth(dtHoje) & DateTime.GetMonth(dtHoje) & _
DateTime.GetHour(dtHoje) & DateTime.GetMinute(dtHoje) & _
DateTime.GetSecond(dtHoje) & ".jpg"


out = File.OpenOutput(File.DirRootExternal, strNomeArqFoto, False)
out.WriteBytes(data, 0, data.Length)
out.Close
ToastMessageShow("Foto salva: " & File.Combine(File.DirRootExternal, strNomeArqFoto), True)
btnTiraFoto.Enabled = False
End Sub
 
Upvote 0

Kbogle24

Member
Licensed User
Longtime User
Try

B4X:
camera1.Quality=50
Camera1.OriLandscape
camera1.PictureSize(320,240)
camera1.TakePicture

or

B4X:
camera1.Quality=50
Camera1.OriPortrait
camera1.PictureSize(320,240)
camera1.TakePicture
 
Last edited:
Upvote 0

upsis

Member
Licensed User
Longtime User
Same problem. The strange thing is that the example provided with the library is working perfectly.
 
Upvote 0

upsis

Member
Licensed User
Longtime User
Thank you, now works but the file with picture is empty. What could be now?
thanks is advance.
 
Upvote 0

upsis

Member
Licensed User
Longtime User
I note if I use camera1.PictureSize(640,480) it works, but don´t if I use camera1.PictureSize(320,240).
 
Upvote 0

Kbogle24

Member
Licensed User
Longtime User
I know my camera can't support 320x240 so it might be the same with yours. What device are you testing this on?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…