ERROR on Activity.LoadLayout("cum")
B4X:
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 camera As AdvancedCamera
Dim Panel1 As Panel
Dim ImageView2 As ImageView
'Dim ImageView6 As ImageView
Dim close As ImageView
Dim img4 As ImageView
Dim PanelImage As Panel
Dim PanelFrame As Panel
Dim finale As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("cum")
If File.Exists(File.DirRootExternal,"Simulatore Camera") Then
img4.Bitmap=LoadBitmap(File.DirRootExternal,"Simulatore Camera/sagoma.png")
img4.Visible=True
Else
File.MakeDir(File.DirRootExternal, "Simulatore Camera")
img4.Bitmap=LoadBitmap(File.DirRootExternal,"Simulatore Camera/sagoma.png")
img4.Visible=True
End If
End Sub
Sub Activity_Resume
camera.Initialize(Panel1, "camera")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Activity.Finish
End Sub
Sub camera_Ready (Success As Boolean)
If Success Then
camera.StartPreview
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
Sub camera_PictureTaken (Data() As Byte)
camera.StartPreview
'Dim c As Char = Chr(Rnd(33, 127)) 'nome casuale
close.Visible=True
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "Simulatore Camera" & "foto.jpg", False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
Panel1.Visible=False
PanelImage.Visible=True
PanelImage.SetBackgroundImage(LoadBitmap(File.DirRootExternal, "Simulatore Camera" & "foto.jpg"))
PanelFrame.Visible=True
PanelFrame.SetBackgroundImage(LoadBitmap(File.DirRootExternal,"Simulatore Camera/sagoma2.png"))
Dim BView As B4XView = PanelImage
Dim l As Int = PanelImage.Left
Dim T As Int = PanelImage.Top
finale.SetBackgroundImage(BView.Snapshot)
PanelImage.SetLayout(l,T,PanelImage.Width,PanelImage.Height)
finale.Visible=True
ImageView2.visible= False
End Sub
Sub close_Click
camera.StartPreview
img4.Visible=True
close.Visible=False
PanelImage.Visible=False
Panel1.Visible=True
ImageView2.Visible=True
File.Delete(File.DirRootExternal, "Simulatore Camera" & "foto.jpg")
PanelImage.Visible=False
PanelFrame.Visible=False
finale.Visible=False
End Sub
Sub ImageView2_Click
camera.TakePicture
End Sub