Android Question Copy and write files

Discussion in 'Android Questions' started by Sub7, Feb 5, 2015.

  1. Sub7

    Sub7 Active Member Licensed 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?

    Code:
    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: Feb 5, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    File.DirInternal is always writable.
     
    Sub7 likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice