mcorbeel Active Member Licensed User Longtime User Jan 1, 2021 #1 I am using B4xPages and am struggeling with how to select a photo from the phone's album. In a previous non-B4xPages project that I made I used: B4X: Copy Camera1.Initialize("Camera1", oPage) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) But "oPage" is a Page object in B4i and I cannot use that with B4xPages. So how can I solve this? Thanks for the help!
I am using B4xPages and am struggeling with how to select a photo from the phone's album. In a previous non-B4xPages project that I made I used: B4X: Copy Camera1.Initialize("Camera1", oPage) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) But "oPage" is a Page object in B4i and I cannot use that with B4xPages. So how can I solve this? Thanks for the help!
mcorbeel Active Member Licensed User Longtime User Jan 1, 2021 #2 Think I found it... B4X: Copy Dim p As Page = B4XPages.GetNativeParent(B4XPages.MainPage.Page_GaleryB4i) Camera1.Initialize("Camera1", p) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) Upvote 0
Think I found it... B4X: Copy Dim p As Page = B4XPages.GetNativeParent(B4XPages.MainPage.Page_GaleryB4i) Camera1.Initialize("Camera1", p) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL)
mcorbeel Active Member Licensed User Longtime User Jan 2, 2021 #3 But when I use (in the B4XPage_Created section): B4X: Copy Dim p As Page = B4XPages.GetNativeParent(B4XPages.MainPage.Page_GaleryB4i) Camera1.Initialize("Camera1", p) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) I get: Warning: Attempt to present <UIImagePickerController: 0x180ace00> on Page (vc): Foto kiezen whose view is not in the window hierarchy! Click to expand... Upvote 0
But when I use (in the B4XPage_Created section): B4X: Copy Dim p As Page = B4XPages.GetNativeParent(B4XPages.MainPage.Page_GaleryB4i) Camera1.Initialize("Camera1", p) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) I get: Warning: Attempt to present <UIImagePickerController: 0x180ace00> on Page (vc): Foto kiezen whose view is not in the window hierarchy! Click to expand...
Erel B4X founder Staff member Licensed User Longtime User Jan 3, 2021 #4 Check this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/ Note that the discussed fix related to the pages stack is no longer needed with the latest version of B4XPages (it will do no harm). Upvote 0
Check this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/ Note that the discussed fix related to the pages stack is no longer needed with the latest version of B4XPages (it will do no harm).
mcorbeel Active Member Licensed User Longtime User Jan 3, 2021 #5 Erel said: Check this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/ Note that the discussed fix related to the pages stack is no longer needed with the latest version of B4XPages (it will do no harm). Click to expand... Thank you Erel. I did examine the suggested solution (https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/) but when I try to install the sample project that is provided on that page I cannot install it. My android phone just says "App not installed" without any other error logging. What could be the resaon for this? Upvote 0
Erel said: Check this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/ Note that the discussed fix related to the pages stack is no longer needed with the latest version of B4XPages (it will do no harm). Click to expand... Thank you Erel. I did examine the suggested solution (https://www.b4x.com/android/forum/threads/b4x-b4xpages-intent-based-camera.120721/) but when I try to install the sample project that is provided on that page I cannot install it. My android phone just says "App not installed" without any other error logging. What could be the resaon for this?
mcorbeel Active Member Licensed User Longtime User Jan 3, 2021 #6 I now copied the code from the sample project in my own project and there it works fine... Nice solution btw... Upvote 0
I now copied the code from the sample project in my own project and there it works fine... Nice solution btw...
mcorbeel Active Member Licensed User Longtime User Jan 3, 2021 #7 I have just noticed that I mixed 2 things together in this post, (1) taking a picture and (2) selecting a picture from the galery. Sorry for that. The Intent-based camera sample was indeed a nice solution for the 1st issue, but my post originally was created for the selection of a picture from the galery in B4i. So can we revert to this issue? I have made this in the past using the "ALAssets" library that I found on this forum, but a lot of users reported problems with that. So I want to do this with the camera SelectFromPhotoLibrary function but I cannot get this to work. I use: B4X: Copy Dim p As Page = B4XPages.GetNativeParent(B4XPages.MainPage.Page_GaleryB4i) Camera1.Initialize("Camera1", p) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) but all I get is a black screen. Upvote 0
I have just noticed that I mixed 2 things together in this post, (1) taking a picture and (2) selecting a picture from the galery. Sorry for that. The Intent-based camera sample was indeed a nice solution for the 1st issue, but my post originally was created for the selection of a picture from the galery in B4i. So can we revert to this issue? I have made this in the past using the "ALAssets" library that I found on this forum, but a lot of users reported problems with that. So I want to do this with the camera SelectFromPhotoLibrary function but I cannot get this to work. I use: B4X: Copy Dim p As Page = B4XPages.GetNativeParent(B4XPages.MainPage.Page_GaleryB4i) Camera1.Initialize("Camera1", p) Camera1.SelectFromPhotoLibrary(Sender, Camera1.TYPE_ALL) but all I get is a black screen.
Erel B4X founder Staff member Licensed User Longtime User Jan 4, 2021 #8 Sorry but I don't understand anything from this thread. How is the Android phone related to this B4i question? Take the intent based example and change TakePicture with SelectFromPhotoLibrary. If it doesn't work then upload the modified example. Don't make any other change. Upvote 0
Sorry but I don't understand anything from this thread. How is the Android phone related to this B4i question? Take the intent based example and change TakePicture with SelectFromPhotoLibrary. If it doesn't work then upload the modified example. Don't make any other change.
mcorbeel Active Member Licensed User Longtime User Jan 4, 2021 #9 I didn't realize that the Intent-based sample was also the solution for selecting an image from library, hence the confusion. I tried your suggestion and it works perfectly! Upvote 0
I didn't realize that the Intent-based sample was also the solution for selecting an image from library, hence the confusion. I tried your suggestion and it works perfectly!