Android Tutorial [B4X] [B4XPages] Intent based camera

B4A + B4i project that uses an intent in B4A and the Camera object in B4i to take a picture using the default camera app.

The B4A code depends on JpegUtils:
It rotates the bitmap based on the EXIF orientation attribute.

Don't miss:
- Manifest code in B4A.
- #PListExtra in main module in B4i.

B4i code was updated to fix an issue with the top page being removed from B4XPages stack.

The change adds a line before and after the Wait For Camera_Complete call:
Dim TopPage As String = B4XPages.GetManager.GetTopPage.Id
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.


    119 KB · Views: 609
Last edited:


Active Member
Licensed User
Excellent project Congratulations Erel!
Could you create an example but save the photos in a database or at least save the route of the photo taken? Thank you!


Well-Known Member
Licensed User
The above example demonstrates taking a picture with the camera , saving it as a bitmap and setting it to ImageView. (see Button1_Click sub)

Here is some code to save that bitmap to Local SQL database and also retrieving it again (to Bitmap) .. There are many more examples available in the forum.