Android Question including files into project for development

Discussion in 'Android Questions' started by leitor79, Mar 18, 2015.

  1. leitor79

    leitor79 Active Member Licensed User


    I need to use a sqlite file on my app, and I'm not sure about the implementation since I've never used a database on an android app before.

    Would you recommend to create it within the app, if the file doesn't exist, or It's better to create it with some tool (sqlite database explorer), adding it into the files's project and be copied to the device upon development?

    If the last case is recommended; adding the file into the files's project will automatically make the file to be copied into the device? Where (file.dirrootinternal, etc?)? I need the file to be read/write, and not to be automatically deleted when the devices runs low on storage...

    Thank you very much!
  2. Eumel

    Eumel Active Member Licensed User

    You can make both. Create with code, or put in in the files folder.

    The second way, you must copy the db from "file.dirAssets" to the folder you need at Appstart.

    If File.Exists(DBFileDir,DBFileName) = False Then
    End If
    If your device has a sd card, you can copy it there. So test it with

    If File.ExternalWritable = True Then
            DBFileDir = 
            DBFileDir = 
    End If

  3. leitor79

    leitor79 Active Member Licensed User

    thank you very much, Eumel!!!
  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