Android Question Reading variables in second screen

AndyUK

Member
Licensed User
Hi


I have a project with 2 screens, the main one and a settings screen. I am receiving the data via Bluetooth and can display the value on the main screen but cannot find how to ‘read’ the data from the main screen (where I don’twant to view the data). I have Dim the variables on both screens and added a text label to the target setting screen but it blank. If for testing I assign a value to the value it all works fine.


Main:-

SubProcess_Globals

'These global variables will be declared once when the application starts.

'These variables can be accessed from all modules.



Dimlbl_tap_count AsLabel

Dimtap_countAsInt

DimstrTapCount AsString


SubGlobals

'These global variables will be redeclared each time the activity is created.

'These variables can only be accessed from this module.


Dimlbl_tap_count AsLabel

Dimtap_countAsInt

DimstrTapCount AsString



Settings:-

SubGlobals

'These global variables will be redeclared each time the activity is created.

'These variables can only be accessed from this module.


DimstrTapCount AsString

Dimlbl_tapCountText AsLabel ' text above data

Dimlbl_tap_count AsLabel
 

Geezer

Active Member
Licensed User
Longtime User
Just dim them on the main screen.

Example

On main:

B4X:
Sub Process_Globals

Dim SomeVariable as string

End Sub

Then just access it like this from your settings screen.

B4X:
YourLabel.Text = Main.SomeVariable
 
Upvote 0

AndyUK

Member
Licensed User
Just dim them on the main screen.

Example

On main:

B4X:
Sub Process_Globals

Dim SomeVariable as string

End Sub

Then just access it like this from your settings screen.

B4X:
YourLabel.Text = Main.SomeVariable

Thank you so much Geezer, now working perfectly. I spent days trying to get this to work and the answer was 'Main.'
Andrew
 
Upvote 0
Top