Android Question [SOLVED] Can not connect to sqlite db under lollipop...

Discussion in 'Android Questions' started by Luis Felipe, Jul 23, 2015.

  1. Luis Felipe

    Luis Felipe Member Licensed User

    Hi everyone,
    My problem is that my app I made and was working under Android 4.2.2 with the 2 tablets I got, now is not working with my new smartphone : the difference ? it's running under Android 5.0.2.
    When I compile (debug o release mode) I got this error message :
    it stops on the line of code with the SQL.Initialize:
    Code:
    If File.Exists(File.DirDefaultExternal & "/Encuestas""latbusdev.db") = False Then
            
    'File.Delete(File.DirRootExternal & "/Encuestas", "latbusdev.db") ' only for testing, removes the database
                SQL1.Initialize(File.DirDefaultExternal & "/Encuestas""latbusdev.db"True)
                CreateDataBases
            
    'check if the database already exists
            Else
                
    'if not, initialize it
                SQL1.Initialize(File.DirDefaultExternal & "/Encuestas""latbusdev.db"True)
                
    'and create it
               
            
    End If
    The other big difference with my previous device is that the new one has no sdcard slot.
    I updated the path configuration to C:\Android\platforms\android-21\android.jar.
    I tried with DirInternal and testing If File.ExternalWritable = True but no...
    There are a couple of days that I'm testing everything I can imagine but nothing is working : any help is apreciated.
    Of course I'm in debugging mode with this Lollipop device.
    Thanx in advance.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Which line fails?

    Are you creating this folder if it doesn't already exist?
     
  3. Luis Felipe

    Luis Felipe Member Licensed User

    The third one Erel, that one : "SQL1.Initialize(File.DirDefaultExternal & "/Encuestas", "latbusdev.db", True)"

    Here is my whole code for my Activity_Create :

    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
        
    If FirstTime Then
        
    Log(File.DirInternal)
       
            
    '---Me conecto al servidor FTP y descargo los archivos necesarios para la bdd de los inspectores / conductores---
            FTP.Initialize("FTP""xxx.xxx.xx.x"21"ftp@xxx.com""xxxx")
            
    FTP.PassiveMode = True
            downloadcount = 
    0
            
    FTP.DownloadFile("/encuestas/tconductores.txt"FalseFile.DirInternal & "/Encuestas""tconductores.txt")
           
    '    If File.ExternalWritable = True Then
            If File.Exists(File.DirInternal & "/Encuestas""latbusdev.db") = False Then
                
    'File.Delete(File.DirRootExternal & "/Encuestas", "latbusdev.db") ' only for testing, removes the database
                SQL1.Initialize(File.DirInternal & "/Encuestas""latbusdev.db"True)
                CreateDataBases
            
    'check if the database already exists
            Else
                
    'if not, initialize it
                SQL1.Initialize(File.DirInternal & "/Encuestas""latbusdev.db"True)
                
    'and create it
               
            
    End If
       
        
    End If
                    
    Activity.LoadLayout("MenuPrincipal_NewLogo")
    End Sub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Use File.MakeDir to create the folder if the file doesn't exist.
     
  5. Luis Felipe

    Luis Felipe Member Licensed User

    Thank you Erel. That part is now working. But now my layout is not showing on screen. Why ? that's true that my app was running before on tablets but I did not do anything to prevent running it on smartphone. Is it related to the Designer ?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question. Make sure to provide more information.
     
Loading...