Sub Camera1_PictureTaken (Data() As Byte)
Dim filename As String = "1.jpg"
Dim dir As String = File.DirRootExternal
camEx.SavePictureToFile(Data, dir, filename)
or
B4X:
Sub Camera1_PictureTaken (Data() As Byte)
Dim filename As String = "1.jpg"
Dim dir As String = File.DirRootExternal
Dim instr As InputStream
instr.InitializeFromBytesArray(Data,0,Data.Length)
Dim bmp As Bitmap
bmp.Initialize2(instr)
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, filename, False)
bmp.WriteToStream(out, 100, "JPEG")
out.Close
Sub Camera1_PictureTaken (Data() As Byte)
Dim filename As String = "1.jpg"
Dim dir As String = File.DirRootExternal
camera1.StartPreview
Dim out As OutputStream
out = File.OpenOutput(dir, filename, False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
ToastMessageShow("Image saved: " & File.Combine(dir, filename), True)
btnTakePicture.Enabled = True
End Sub
I dont know if the original camera app sends an broadcast for the new picture or something similar.
So, i don´t know how to capture the filename of the picture just taken.
I think, no need to pay for helps. Helps are not related to getting money, it is related to konowledge, experience and willingness.
There may be an approach from picture filename format. Original camera app saves to file "YYYYMMDD_HHMMSS.jpg".
We can suppose that the biggest filename number is the last file.
You can do it step by step:
- Your app get all pictures into the list at firts run. Then, it keeps on run in the background.
- You take picture with original camera app. A new picture will be saved.
- Your app checks the new file that is not in the list, finds and renames. You can search the biggest number in the filename. According to the filename format, biggest number is the newest picture.
I can help you to write this sample if you convinced to the good idea.
Dim A,B,C,D As String
A = $"$DateTime{DateTime.Now}"$
A = A.Replace(":","")
B = A.SubString2(6,10) & A.SubString2(0,2) & A.SubString2(3,5)
B = B & "_" & A.SubString2(11,15)
Activity.Title = B
For I = 0 To 59
If I < 10 Then
D = "0" & I
Else
D = I
End If
C = B & D & ".jpg"
If File.Exists(File.DirRootExternal, C) Then
Activity.Title = C
Else
Activity.Title = "Error"
End If
Next