Android Question VIEW PHOTOS IN GALLERY TAKEN FROM THE B4A APPLICATION

LuisJaramillo33

New Member
HELP! I have an application created and it takes photos without problems, the problem comes when I enter my gallery and the photos taken are not displayed.

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region

Sub Process_Globals

End Sub

Sub Globals
Dim rp As RuntimePermissions
Dim camera1 As Camera
Private captura As Button
Private PanelFoto As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Foto")
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
rp.CheckAndRequest(rp.PERMISSION_CAMERA)
If File.Exists(File.DirRootExternal,"CARPETA") <>True Then
File.MakeDir(File.DirRootExternal,"CARPETA")
End If
End Sub

Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
captura.Enabled = True
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub

Sub Activity_Resume
captura.Enabled = False
camera1.Initialize(PanelFoto, "Camera1")
End Sub

Sub Activity_Pause (UserClosed As Boolean)
camera1.Release
End Sub

Sub Camera1_PictureTaken (Data() As Byte)
camera1.StartPreview
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal&"/Omnitec", "img"&B4XPages.MainPage.img&".png", False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
' File.Copy(File.DirRootExternal, "img"&img&".png", File.DirRootExternal&"/CARPETA", "img"&img&".png")
' File.Delete(File.DirRootExternal, "img"&img&".png")
ToastMessageShow("Foto Guardada", True)
captura.Enabled = True
Activity.Finish
End Sub
 

Attachments

  • 1616681720306.png
    1616681720306.png
    310.1 KB · Views: 265
  • 1616681798970.png
    1616681798970.png
    310.2 KB · Views: 241
Top