Android Question Error description: Unknown member: isinitialized

Discussion in 'Android Questions' started by SuzanaKamis, Mar 15, 2015.

  1. SuzanaKamis

    SuzanaKamis Member Licensed User

    Hi I just bought b4A four days ago and a newbie and this forum is the only way I could get help. I am having a problem compiling the codes..... the error is as follows:

    B4A version 4.30
    Parsing code. 0.02
    Compiling code. Error
    Error compiling program.
    Error description: Unknown member: isinitialized
    Occurred on line: 47
    If Serial1.IsInitialized = False Then Serial1.Initialize("Serial1")
    Word: isinitialized

    At first I thought it was the library problem but it isn't. I got the libraries enabled:
    core (version 4.01)
    RandomAccessFile (version 1.30)
    Serial (1.20)



    Code:
    #Region  Project Attributes
        
    #ApplicationLabel: btControl
        
    #VersionCode: 1
        
    #VersionName:
        
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
        
    #CanInstallToExternalStorage: False
    #End Region

    #Region  Activity Attributes
        
    #FullScreen: False
        
    #IncludeTitle: True
    #End Region

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

    Sub Globals
        
    'These global variables will be redec from this module.
    'lared Each time the Activity Is created.
        'These variables can only be accessede

        
    Dim AlmC As Int
        
    Private ImgLogo As ImageView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        Activity.LoadLayout("frmmain")
        ImgLogo.Width = 
    Activity.Width
        ImgLogo.Height = 
    Activity.Height
        ActiveCom.SalirApp=
    False
       
    End Sub

    Sub Activity_Resume
        
    StopService(ActiveCom)
        
    If ActiveCom.SalirApp Then
           
            
    Activity.Finish
        
    Else
            
    If Serial1.IsInitialized = False Then Serial1.Initialize("Serial1")
           
            ActiveCom.ActividadName =
    "main"
           
            
    If Serial1.IsEnabled = False Then
                
    Msgbox("Active Bluetooth.""")
                
    Activity.Finish
            
    Else
                Serial1.Listen
                Serial1.Disconnect
                Connect
                
            
    End If
        
    End If
       
    End Sub


    Sub Activity_Pause (UserClosed As Boolean)
        
    If UserClosed Then
            
    StopService(ActiveCom)
            Serial1.Disconnect
        
    End If
    End Sub

    Sub Connect
        
    Dim PairedDevices As Map
        PairedDevices = Serial1.GetPairedDevices
        
    Dim l As List
        l.Initialize
        
    For i = 0 To PairedDevices.Size - 1
            l.Add(PairedDevices.GetKeyAt(i)) 
    'add the friendly name to the list
        Next
        
    Dim res As Int
        res = 
    InputList(l, "Select Device", -1'show list with paired devices
        If  res <> DialogResponse.CANCEL Then
            Serial1.Connect(PairedDevices.Get(l.Get(res))) 
    'convert the name to mac address
        End If
    End Sub

    Sub Serial1_Connected (Success As Boolean)
        
    If Success Then       
           
            
    StartService(ActiveCom)
            
    ToastMessageShow("Connection completed",  False)

           
        
    Else
            
    'Servicio.connected = False
            Msgbox(LastException.Message, "Connection Error.")
            Serial1.Disconnect
            ActiveCom.SalirApp=
    True
            
    StopService(ActiveCom)
            
    Activity.Finish
        
    End If
    End Sub
    Sub TramaRecepcionada(Trama As String)

         
    Dim Lin As String
        Lin = AlmC
       
        
    Do While Lin.Length <2
            Lin=
    "0"&Lin
        
    Loop
        
    If Trama="OK" Then
            
    StartActivity(ActControl)
        
    Else
            EnvioComando.NuevoComando(
    "@INICOM")
        
    End If

    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Make sure that there is no code module named Serial1.

    Please upload your project (File - Export as zip).
     
  3. SuzanaKamis

    SuzanaKamis Member Licensed User

    attached is the uploaded file
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    The correct version of the Serial library is 1.23. This library is part of B4A v4.30. Have you replaced it with an older file for some reason?
     
  5. SuzanaKamis

    SuzanaKamis Member Licensed User

    i think i did accidentally....:oops:
     
  6. SuzanaKamis

    SuzanaKamis Member Licensed User

    let me find the version 1.23 and get back to you soon..
     
  7. SuzanaKamis

    SuzanaKamis Member Licensed User

    seems like i could not find v1.23 in this forum.. should i uninstall and reinstall my b4A?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Make sure that there is no serial library in the additional libraries folder.
     
  9. SuzanaKamis

    SuzanaKamis Member Licensed User

    Thanks I have reinstalled and uninstalled the b4A and it works well... lesson learnt for me not to play around with the libraries! :D
     
Loading...
  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