Error in Common Module

Discussion in 'Android Questions' started by stevieg, Jun 11, 2013.

  1. stevieg

    stevieg Member Licensed User

    I have a large project that had multiple panels and views and after a lot of work I realized that I should have done multiple Activities each with its own screen.

    So, I went back and started to separate everything and do it correctly as shown in the Beginners Guide.

    I started to put all the common subs in a code module called Common.
    I started with the code below and now I get this error:

    Here is the error:

    B4A line: 8
    Dim DBFileDir As String : DBFileDir = getSDCardPath 'File.DirDefaultExternal
    javac 1.7.0_07
    src\en\vtg\mim\ error: cannot find symbol
    _dbfiledir = _getsdcardpath(_ba);
    symbol: variable _ba
    location: class common
    1 error

    Here is the code in the Common Module:

    Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

    Dim DBFileDir As String : DBFileDir = getSDCardPath 'File.DirDefaultExternal
    Dim DBFileName As String : DBFileName = "MIM.db"
    Dim DBFilePath As String : DBFilePath=getSDCardPath 'File.DirRootExternal

    Dim SQL1 As SQL
    Dim SQL2 As SQL
    Dim SQL3 As SQL
    Dim List1 As List
    Dim TTS1 As TTS

    SQL1.Initialize(DBFilePath, DBFileName, False)
    SQL2.Initialize(DBFilePath, DBFileName, False)
    SQL3.Initialize(DBFilePath, DBFileName, False)

    End Sub
    Public Sub getSDCardPath() As String

    Dim iMount, iCRLF, iSlash, iAuto As Int
    Dim fstab As String = File.ReadString("/system/etc/", "vold.fstab")
    Dim Mount As String

    Do While True

    'get next line with mount point:
    iMount = fstab.IndexOf2("dev_mount ", iCRLF)
    If iMount < 0 Then Exit
    iCRLF = fstab.IndexOf2(CRLF, iMount)
    If iCRLF < 0 Then Exit
    Mount = fstab.SubString2(iMount, iCRLF)

    'get mount path:
    iSlash = Mount.IndexOf("/")
    If iSlash < 0 Then Continue
    iAuto = Mount.IndexOf2("auto", iSlash)
    If iAuto < iSlash Then Continue
    Mount = Mount.SubString2(iSlash, iAuto).Trim

    'return this one, if new:
    If Mount <> File.DirRootExternal Then Return Mount


    Return File.DirRootExternal

    End Sub

    I am still pretty new at B4A and I am a little lost in Multiple Activities.
    Any help would be appreciated...
  2. Erel

    Erel Administrator Staff Member Licensed User

    Process_Globals should only be used to declare variables.
  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