activity.initialize

JesseW

Active Member
Licensed User
Longtime User
Erel, 1) what happens when an Activity.Initialize method is executed? it doesn't clear the views or the menu options or anything that I can see.

2) how can I clear the menu options?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You shouldn't call Activity.Initialize. The Activity is always initialized for you.
This method is only available because Activity is a subtype of View.

You can easily remove all views with a code such as:
B4X:
For i = 0 To Activity.NumberOfViews - 1
 Activity.RemoveViewAt(0) '0 NOT i
Next

It is not possible to clear the menu options. You will need to implement a custom menu instead.
 
Upvote 0

B4A Enthusiast

Member
Licensed User
Longtime User
I have a confusing scenario with my views.
When I load the layout containing two editTexts(txtUserName and txtPassword) and two buttons(Login and Quit) from a class (that runs a splashscreen on the main activity). The First editText (txtUserName) gets the focus as intended. However, the two buttons will not respond to click event until the screen is rotated. This is annoying to the user. I want the buttons to be able to sense the click event immediately the layout is loaded from the class module. I thought calling Activity.Initialize from the class module that loaded the layout would help but it didn't. Any suggestions please?
 
Upvote 0

ComposerB4A

Member
Licensed User
Longtime User
Is possible make one "sub" for assing a predeterminated value (ex.: to controls, variables, ...), and this "sub" is called in "initialize" or other procedures
:)
 
Upvote 0
Top