iOS Question Page for cam (iMedia Library)

stevenindon

Active Member
Licensed User
Hello all,

I am trying to implement image content chooser with Below Codes :

B4X:
'******************************************************
'SELECT CONTENT FILE
'******************************************************
Public Sub Photo_Choose(Imagesize As Int)
    cam.SelectFromSavedPhotos(Sender, cam.TYPE_IMAGE)
End Sub
'******************************************************
'CONTENT CHOOSER - FILE SELECTED
'******************************************************
Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
    If Success=True Then
        If Image.IsInitialized Then
            Dim sImgFile1 As Bitmap
            Try
                sImgFile1=Image.Resize(500,500,True)
                Msgbox("Done","")
            Catch
                'return Null
            End Try
        End If
    End If
End Sub

and on top of the code, i need to initialize the cam library. Cam library initialization are as such :
B4X:
cam.Initialize("cam",PageObject)

My problem is when i created the project, the project starts as such :

B4X:
Public Sub Initialize
    B4XPages.GetManager.TransitionAnimationDuration = 0
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
End Sub

How can i create a Page for this root so that i can initialize the cam object? *(Which requires current Page)
I tried putting : cam.Initialize("cam",Root) .... but error. Please help... ?
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
You can initialise the camera like this

B4X:
    Camera.Initialize("cam", B4XPages.GetNativeParent(Me))

GetNativeParent gets the Page, Activity etc based on platform.
 
Upvote 1
Top