Problem NILOBJECT Files

Hello all.

I have a project with a pre-built copyfiles

I have created an APP with propierty DBSourceDisk as SQLiteDatabase

On my copyfiles I have only 1 copy for a file called SMT.sqlite

Then on app opening I’m doing this

Var myFile As FolderItem = SpecialFolder.Resource(“SMT.sqlite”)
If myFile.Exists Then
Var destFile As FolderItem = SpecialFolder.Documents.Child(“SMT.sqlite”)
If destfile.Exists Then
App.DBSourceDisk.DatabaseFile = destfile
else
myFile.CopyTo(destFile)
App.DBSourceDisk.DatabaseFile = destfile
end if

The App.DBSourceDisk.DatabaseFile = destfile generates a NilObjectException

Debugger indicates that source exist.

How can I solve this?

Same with SpecialFolder.ApplicationSupport

What is the destination of your copy script?

Resources Folder, but with SpecialFolder.Resources.child(“SMT.sqlite”) I get same error

what happens if ‘myFile’ doesn’t exist?

I haven’t used Android, so I don’t know if it has limitations with SpecialFolders. I hope someone with Android experience can share some info.

In if myfile.exists checks that file doesn’t exist and there is no nilobjectexception

Norman’s guess is that you never instantiated App.DBSourceDisk before trying to set it’s DatabaseFile property.

You’re right. I commented it in the openning event… I don’t know why…