Android Question java.lang.OutOfMemoryError: Failed to allocate

Matteo Granatiero

Active Member
Licensed User
B4X:
Sub camera_PictureTaken (Data() As Byte)
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "MyDirectory/"  &"BetaImage.jpg", False)
        out.WriteBytes(Data, 0, Data.Length)
        out.Close
End Sub
In practice, I have an app that takes pictures and saves them. The first shot and save everything is smooth, then in the second shot I get this error without referring to the line of code. In short, to make two shots I should close the app and reopen it because it can not shoot and save the second consecutive shot.
I have seen numerous forums but none that solved my problem, maybe you could succeed in doing so by solving this specific.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…