Error about BufferUnderflowException

sally3599

Member
Licensed User
Longtime User
A Error occurred when ReadEncryptedObject:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.AddView(etUser, 10, 10, 100%x-20,50)
   Activity.AddView(etPass, 10, 60, 100%x-20,50)
    Activity.AddView(cmdSubmit, 10, 120, 100%x-20,50)
   
   
    'reading the object
    Dim raf As RandomAccessFile
    raf.Initialize(File.DirRootExternal, "1.dat", False)
    username = raf.ReadEncryptedObject("some secret string", raf.CurrentPosition)
   raf.Close
   
   If username.Length <= 0 Then
      username = "Username"
   End If
   
   etUser.Text=username
   etPass.Text="Password"
End Sub

This Error came from a empty file?? How to check 1.dat is empty or not???

Any help will be appreciate it.
 
Top