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
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).
After searching in the forum, I tried this code: ' The image Dim bitmap As Bitmap = LoadBitmap(File.DirAssets, "prueba.jpg") ' Copy to ...files/pruebas/prueba.jpg Dim Out As OutputStream Dim r As RuntimePermissions Out = File.OpenOutput(r.GetSafeDirDefaultExternal("pruebas"), "prueba.jpg"...
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