Android Question Problem with Android 5

Discussion in 'Android Questions' started by Alberto Michelis, Aug 2, 2015.

  1. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    My app can backup the db to the DirRootexternal and restore it to Dirinternal.
    All works ok in Android 4
    In Android 5 Im having a problem, this is the code:

    If File.Exists(File.DirRootExternal&"/armi.portit.backcup""portit.db")=True Then
    File.Copy(File.DirRootExternal&"/armi.portit.backcup""portit.db"File.DirInternal, "portit.db")
    'File.Copy(File.DirDefaultExternal, "Params", File.DirInternal, "Params")
                        sql1.ExecNonQuery("INSERT INTO logevent VALUES('"&"','mAjustes',0,'Restoring from  SD')")
    Msgbox("Error restoring.","Atention!")
    End Try   
    Msgbox("There's no backup.","Atention!")
    End If
    I catch the error "Error restoring" but the db restore is made OK.
    Then I thought the Error comes from the sql insert, how can I catch this and know which is the error.
    It works ok in Android 4, same app in Android 5 fails.
  2. Erel

    Erel Administrator Staff Member Licensed User

    LastException will hold the error message.
    ArminKH likes this.
  3. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    I split the try cath in two, one for the copy and one for the sql insert.
    The error is because the copy disconects the database or make it read only, I dont know.
    In Android 4 the INSERT is not done but theres no error at all.
    In Android 5 the error is detected ok, see atached image.

    Attached Files:

  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