Android Question Routine WAS working, but now its not...

Discussion in 'Android Questions' started by kepler, Mar 31, 2015.

  1. kepler

    kepler Active Member Licensed User

    Good evening,

    I was testing ABWifi lib, v 1.2, with the following code:

    Code:
    Sub Process_Globals
        
    Dim lat As Double
        
    Dim lon As Double
    End Sub

    Sub Globals
        
    Dim MyWifi As ABWifi
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
       
    Dim r As Boolean
       r = MyWifi.ABLoadWifi()
       r = MyWifi.ABGetLocation(
    "MyWifi")
       
    If r = False Then
          r = MyWifi.GetLastKnownLocation(
    "MyWifi")
          
    If r = False Then
             
    Msgbox (MyWifi.ABWifiLastError(), "")
          
    End If
       
    End If
       
    Msgbox ("" & lat & " - " & lon, "")
       
    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)
       
    End Sub

    Sub MyWifi_FoundLocation ()
       
    Dim ResLocation As ABFoundLocation
       ResLocation = MyWifi.ABGetFoundLocation()
       lat = ResLocation.Latitude
       lon = ResLocation.Longitude
       
    Msgbox ("" & ResLocation.Latitude & " - " & ResLocation.Longitude, "")
    End Sub
    The problem is that at some time I received the second message box with my coords right.
    But now, I'm only getting 0 - 0 values with the first message box, and the second doesn't appear.

    I really know I'm doing something wrong.

    Can someone please help me out?

    Kind regards,

    Kepler
     
  2. kepler

    kepler Active Member Licensed User

    Hi,

    Same thing is happening with another routine... I can't seem to be able to assign the proper values to a variable that I want to be Global.
    If I declare a variable like Var1 in Sub Process_Globals, can't I change it and access it in other sub routines?

    Kepler
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can change the value of a process global variable and access it from other subs or modules.
     
  4. Troberg

    Troberg Well-Known Member Licensed User

    You need to specify the module. So, if you have a module called MyModule, with the public variable MyVar, you'll have to access it with Mymodule.MyVar.
     
  5. Alisson

    Alisson Active Member Licensed User

    I have got this message:

    Code:
    B4A version: 5.50
    Parsing code.    (
    0.00s)
    Compiling code.    Error
    Error compiling program.
    Error description: Unknown member: abloadwifi
    Occurred on line: 
    13
       r = MyWifi.ABLoadWifi()
    Word: abloadwifi
    What to do?
     
  6. DonManfred

    DonManfred Expert Licensed User

    Create a new thread as it is not related to this thread
     
  7. Alisson

    Alisson Active Member Licensed User

    Thank you.
    It was my mistake.
     
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