Android Question Using Process_Globals

Discussion in 'Android Questions' started by Tjitte Dijkstra, Feb 15, 2015.

  1. Tjitte Dijkstra

    Tjitte Dijkstra Member Licensed User

    In my app I need a kind of SETUP-activity to change the language, the level etc.
    To achieve this, I make a test program with 2 activities/modules.
    In both I defined a Process_Global variable and I expected that the value of that variable would change after returning to the main activity, but apperently I did something wrong.
    Who can show me the error? All files are in 2Screen_TD.ZIP
    THIS IS THE MAIN ACTIVITY:

    Sub Process_Globals
    Dim XX As Int
    End Sub

    Sub Globals
    Private button1 As Button
    Private Button2 As Button
    Dim XXLabel As Label
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
    XX = 1
    XXLabel.Text = XX
    End Sub
    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub Button2_Click
    StartActivity("Scherm1")
    End Sub
    Sub button1_Click
    XXLabel.Text = XX 'I expect to see the value rise after retruning from activity Scherm1
    End Sub

    THIS IS THE 2ND ACTIVITY:
    Sub Process_Globals
    Dim XX As Int
    End Sub

    Sub Globals
    Private button4 As Button
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    If FirstTime = True Then Activity.LoadLayout("Scherm1")
    End Sub

    Sub Activity_Resume
    End Sub

    Sub Activity_Pause (UserClosed As Boolean)
    End Sub

    Sub button4_Click
    XX = XX + 5
    StartActivity("Main")
    End Sub
     

    Attached Files:

  2. NJDude

    NJDude Expert Licensed User

    If you are creating the XX in you main activity you don't have to redeclare it on the second activity, just reference it like this:
    Code:
    Main.XX = Main.XX + 5
     
    clurbina and thedesolatesoul like this.
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