D
Deleted member 103
Guest
Hi,
I do not know if it's a mistake, but I think the 2 functions should not have the same functionality.
It can not be that the function "CallSubDelayed (Main," show_Activity_1 ") has the same effect as "StartActivity (Main)", with both functions the main activity is started each time.
Activity 1:
Activity 2:
I do not know if it's a mistake, but I think the 2 functions should not have the same functionality.
It can not be that the function "CallSubDelayed (Main," show_Activity_1 ") has the same effect as "StartActivity (Main)", with both functions the main activity is started each time.
Activity 1:
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
End Sub
Sub Activity_Resume
If Activity2.result.Length > 0 Then
Label1.Text = "You have chosen: " & Activity2.result
Else
Label1.Text = "Please press on the button and choose an item."
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub show_Activity_1
Log("show_Activity_1")
End Sub
Sub Button1_Click
StartActivity(Activity2)
End Sub
Activity 2:
B4X:
Sub Process_Globals
Dim result As String
result = ""
End Sub
Sub Globals
Dim ListView1 As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
For i = 1 To 100
ListView1.AddSingleLine("Item #" & i)
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
result = Value 'store the value in the process global object.
'StartActivity(Main) 'show the main activity again
CallSubDelayed(Main, "show_Activity_1") 'show the main activity again ?
End Sub