Android Question Is it possible to write and read a file from RAM memory ?

alexhi

Member
Licensed User
Longtime User
Hello! Now I take a picture, write it to a SD card and then read it and send it to FTP server. I think the SD card might get damaged. Is it possible to write a snapshot to a temporary file in RAM memory and then read from there. If so, how?

My code now:
If File.Exists(File.DirRootExternal, "face0.jpg") Then
File.Delete(File.DirRootExternal, "face0.jpg")
End If
out = File.OpenOutput(File.DirRootExternal, "face0.jpg", False)
out.WriteBytes(jpeg, 0, jpeg.Length)
out.Close
ToastMessageShow("Image saved: " & File.Combine(File.DirRootExternal, "face0.jpg"), True)

ftp1.Initialize("ftp1","sss.com","21","test","YYYYY180160")
ftp1.UseSSL = False
ftp1.PassiveMode = True
ftp1.UploadFile(File.DirRootExternal,"face0.jpg",False,"/images/face0.jpg")
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
File.DirInternal this is RAM (random access memory)?
Not sure what you are really asking. Yes - it is random access memory. It is the storage area to which only the app has access, unlike File.DirExternal which is accessible to other apps (and shows up in file manager apps). Can't find a link on the forum that explains the different memory regions - maybe someone else can.

EDIT : Here is one of the more useful explanations of file and memory regions.
 
Last edited:
Upvote 0
Top