'**********************************
'CAMERA INTENT
'**********************************
Sub TW_Camera_Init(sPage As Page)
Camera.Initialize("Camera",sPage)
End Sub
Sub TW_Camera_Exec(sPage As String,sWidth As Int,sHeight As Int)As ResumableSub
TakePicture (sPage,sWidth, sHeight)
Wait For Image_Available(Success As Boolean, bmp As B4XBitmap)
If Success=True Then
Return bmp
Else if Success=False Then
Dim TmpImg As B4XBitmap=LoadBitmap(File.DirAssets,"empty.png")
Return TmpImg
End If
End Sub
Private Sub TakePicture (sPage As String,TargetWidth As Int, TargetHeight As Int)
Camera.TakePicture
Dim TopPage As String = sPage
Wait For Camera_Complete(Success As Boolean, Image As Bitmap, VideoPath As String)
B4XPages.GetManager.mStackOfPageIds.Add(TopPage) 'this is required as the page will be removed from the stack when the external camera page appears.
If Success Then
Dim bmp As B4XBitmap = Image
bmp.Resize(TargetWidth, TargetHeight, True)
CallSubDelayed3(Me, "Image_Available", True, bmp)
Else
CallSubDelayed3(Me, "Image_Available", False, Null)
End If
End Sub