Android Question How to transfer data to another form?

Status
Not open for further replies.

Junctbr

Member
How to transfer data to another form?
Example: The value of the lblName = Jun
How to transfer "Jun" to another form?
Thank you ^^
 

mangojack

Expert
Licensed User
Longtime User
There are no forms in B4A .. I think you mean Activities.

In your Main Activity or Activity1 declare a Process Global variable

B4X:
Public myVar As String

then when ready .. assign the value of lblName.Text to this variable
B4X:
myVar = lblName.Text

In Activity2 you can access this variable by calling Main.myVar or Activity1.myVar

Have you read these Guides ? ...

Beginners Guide
Users Guide
 
Upvote 0

Junctbr

Member
There are no forms in B4A .. I think you mean Activities.

In your Main Activity or Activity1 declare a Process Global variable

B4X:
Public myVar As String

then when ready .. assign the value of lblName.Text to this variable
B4X:
myVar = lblName.Text

In Activity2 you can access this variable by calling Main.myVar or Activity1.myVar

Have you read these Guides ? ...

Beginners Guide
Users Guide
Thank you, mangojack ^^

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Public myVar As String
End Sub


B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout1")   
    myVar = etName.Text
End Sub


Second Activity:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("layout2")
    lblUser.Text = Main.myVar   
    End Sub

My bad, mangojack.
What I mean is the name I input at etName.Text will go to another activity.
It only display("")
Thank you sir ^^
 
Upvote 0
Status
Not open for further replies.
Top