Hi All,
I have 3 questions:
1) I require functionality to edit a file , make edits and save to same file,, do I have the ability to overwrite files in DirRootExternal , if not then I must create a new file to save that new version?
2) What is the procedure to write to any file type in File.DirRootExternal I used to use RandomAccessFile but now I use ContentResolver and File.Readbytes to get a byte array to read from a file that works fine.
Now I assumed if the following code worked for Reading
I thought I could use the following Writing to same file using the byte array sa
But it returns an error saying cannot write to file.
3) Is there a way to convert RandomAccessFile to an Inputstream?
I have 3 questions:
1) I require functionality to edit a file , make edits and save to same file,, do I have the ability to overwrite files in DirRootExternal , if not then I must create a new file to save that new version?
2) What is the procedure to write to any file type in File.DirRootExternal I used to use RandomAccessFile but now I use ContentResolver and File.Readbytes to get a byte array to read from a file that works fine.
Now I assumed if the following code worked for Reading
B4X:
Dim cc As ContentChooser
cc.Initialize("cc")
cc.Show("*/*", "Choose File")
Wait For CC_Result (Success As Boolean, dirtmp As String, filenametmp As String)
Dim res As LoadResult = CreateLoadResult(Success, dirtmp, filenametmp)
If res.Success Then
res.RealName=GetFileInfoByIndex("_display_name", res.filename)
sa=File.ReadBytes(res.Dir,res.filename)
I thought I could use the following Writing to same file using the byte array sa
B4X:
File.WriteBytes(res.Dir,res.filename,sa)
But it returns an error saying cannot write to file.
3) Is there a way to convert RandomAccessFile to an Inputstream?
Last edited: