Android Question Copy and write files

Sub7

Active Member
Licensed User
Longtime User
Hello all,
i write and read some user informations in a file, the following pseudocode works on all my devices but i just got a feedback from a customer that the app force closes in his device,
exactly when it is writing the file, what it could be?
Is possible that file.dirinternal is not writable? this can happen?

B4X:
Sub Activity_Create(FirstTime As Boolean)

If File.Exists(File.DirInternal,"file.syx") = False Then
File.copy(File.DirAssets,"file.syx",File.DirInternal,"file.syx")

'Write default dummy values
static_functions.writeUserFile(0,0,0,"A","B","C",0)
else 
log("error")
End if

End sub



'This is the sub i use to write in the file

Sub writeUserFile(data1 As Int, data2 As Int, data3 As Int, data4 As String, data5 As String, data6 As String, data7 As Int)
   Dim raf As RandomAccessFile
   Dim WriteList As List
   WriteList.Initialize
   WriteList.Add(data1)
   WriteList.Add(data2)
   WriteList.Add(data3)
   WriteList.Add(data4)
   WriteList.Add(data5)
   WriteList.Add(data6)
   WriteList.Add(data7)
   raf.Initialize(File.DirInternal, "file.syx", False)
   raf.WriteEncryptedObject(WriteList, "password", raf.CurrentPosition)
   raf.Close

End Sub

Thanks


http://developer.android.com/training/basics/data-storage/files.html

so if dirinternal is always available, what's going on? :)
 
Last edited:
Top