Two activities - problem with the 'global'

SteveBee

Member
Licensed User
Longtime User
I have read the tutorial re. Two Activities, but am having a problem implementing it.

My Main is a ListView; I have this in the itemclick handler:
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
    JobViewID = value                            'store the value in the process global object.
    StartActivity(JobForm) 
End Sub
Note that JobViewID is a global:
B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

   Dim parser As SaxParser, JobViewID As String
End Sub
So, when the listitem is touched, I expect the Jobform to load; in its create sub, I have:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout(("JobForm")
    Activity.Title = Activity.Title & "  " & JobViewID
End Sub
But when I try to compile I get a warning re. the 'global':
Compiling code. Error
Error parsing program.
Error description: Undeclared variable 'jobviewid' is used before it was assigned any value.
Occurred on line: 17
Activity.Title = Activity.Title & " " & JobViewID

I thought I had emulated the example, and I did put my link var. ("JobViewID") in the global section, but it doesn't link. It did seem a strange way of doing things... but that was what it said in the tutorial (in my reading).

Can you clear up my misunderstanding?

Steve
 
Top