Android Question Native Camera Intent

MODERN TALKING

Active Member
Licensed User
Hi guys,

Glad to be back with the B4X Brotherhood :cool:

How you guys been?

This used to work 3 years ago but not now - can take picture but cannot save

Image Capture:
Dim i As Intent
i.Initialize("android.media.action.IMAGE_CAPTURE", "")
i.PutExtra("output", ParseUri("file://" & File.Combine(File.DirInternal, PictureName)))
StartActivity(i)
            
Sub ParseUri(FileName As String) As Object
    Dim r As Reflector
    Return r.RunStaticMethod("android.net.Uri", "parse", Array As Object(FileName), Array As String("java.lang.String"))
End Sub

App crashes unless I comment i.PutExtra

Has command methodology or Manifest changed?

Thank you very much
 

José J. Aguilar

Expert
Licensed User
In File.DirInternal ("file://" & File.Combine(File.DirInternal, PictureName)
You can try
B4X:
Log(File.DirInternal)
To see where it is.


As a general rule:
- Store private files in File.DirInternal and public files in File.DirDefaultExternal or if you want to support runtime permissions then use RuntimePermissions.GetSafeDirDefaultExternal (SEE THE TUTORIAL).

If you want to show it in the gallery:
 
Upvote 0

MODERN TALKING

Active Member
Licensed User
Been away too long. Tough to get back in the swing of things

If anyone can solve this - then donation of USD 10 through Paypal - as a small token of my appreciation

Things have changed in two years - so what worked back then, ain't workin' now

Just need:

1. Open Native Camera
2. Take Picture - with manual click
3. SAVE PICTURE - in a Folder called "Demo"

Can do? Mighty obliged guys, if possible

Back online in a couple of hours
 
Upvote 0

Descartex

Well-Known Member
Licensed User
Longtime User
Hi!!
Attached sample does the job on the root directory, Just add the folder you need (ensure it exists or create it before saving)
Best regards!
Edit:
File is too large to be attached.
You can download it from http://descartexapps.es/apps/CameraExample.zip
 
Upvote 0
Top