iOS Question Camera.TakePicture Closing Page

tariqyounis

Member
Licensed User
Longtime User
I am using b4xpages and when I execute the procedure to take a picture and save it to an imageview, The function b4xpages.closepage(me) will not work and I can't exit the page. Otherwise if I did not use the function camera.takepicture the page will close normally
please advice.
 

tariqyounis

Member
Licensed User
Longtime User
Check this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/

Can you reproduce this issue with that example? Please make the necessary changes and upload the project.
I used the same project, but I added one button (button2) to try to close the page. if I press button2 first I got this log "First page cannot be closed" which means that button2 is working fine, but if I press button2 after I take the picture, no action is triggered.
close page:
Sub Button2_Click
    B4XPages.ClosePage(Me)
End Sub
 
Upvote 0

tariqyounis

Member
Licensed User
Longtime User
You can only close the top page and you can only close the top page if there are other pages in the stack. In this case there is a single page.
you are absolutely right, but even if you have other pages it will not work. I was checking the log when it says "First page cannot be closed", I know that button2 is working, but after taking the picture, and I press on button2 there is no action in the log. This means that the program is running over the code b4xpages.closepage(me), but not executing it.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
It looks that exactly Camera.TakePicture destroys B4XPage engine.
I reduced B4XMainPage to followng
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private Camera As Camera
End Sub

Public Sub Initialize
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
   
    Sleep (100)   
    Camera.Initialize("Camera", B4XPages.GetNativeParent(Me))
    Log ("Before " & B4XPages.GetManager.GetTopPage.B4XPage)
    Camera.TakePicture
    Sleep (5000)
    Log ("After " & B4XPages.GetManager.GetTopPage.B4XPage)
End Sub

'After' is null in any case.
 
Upvote 0
Top