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: https://www.b4x.com/android/forum/threads/11629/#content
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:
B4X:
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.
 

Attachments

  • Project.zip
    119 KB · Views: 623
Last edited:

Daniel44

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!
 

mangojack

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.

 

yzhy-mail

New Member
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!
I cann't agree with you more!
I learn the B4X deponding on example absolutly!
Example help me to understand the method qucikly.
if someone can give a example about "save and update the photos in a database and save the route of the photo taken"
that's so very kind of you !
 
Top