How to Declare an EditText so it can be read all code modules. I get the error if I put it into the Sub Process_Globals (Error description: Cannot access activity object from sub Process_Globals.)
I have tried many things in for many houers and no I take a big break
Views, like EditText , belong to an Activity so you cannot declare them in Process_Globals but only in Globals.
What you can do is transmit the EditText as a parameter in a sub call.
Activity objects "die" when the Activity is closed(Activity.Finish). Therefore, you can't access them this way. You should reverse your logic (access CodeModules from Activities).
Code module:
B4X:
Sub doIt(txt as EditText)
txt.Text = "My value was set by the CodeModule doIt() method"
End Sub
In your Activity:
B4X:
'In Globals:
Dim theField as EditText
'In Activity_Create or wherever
CodeModuleName.doIt(theField)
Another examples have been posted above by Erel and Klaus.