Android Question Save and run several activities..

Nb1320

Member
Licensed User
Longtime User
Im sure, Im making this more difficult than it is, but I am still learning and find myself too often searching for help on the forums. I have a layout with a bunch of checkboxes on it. Each checkbox has its own module to be loaded. I want to make it where the user can check several checkboxes and then load the modules attached to those checkboxes in order. If anyone has an example or just a snippet, I can go from there. I just wasnt sure how to word it while searching the forums. Any help is appreciated, thank you.
 

thedesolatesoul

Expert
Licensed User
Longtime User
So in the load click you need to save a list of all your modules

B4X:
Process_Globals
   Dim lstModules as List

Sub Load_Click
   lstModules.Initialize
   If Check1.Checked = True then
           lstModules.Add("Module1")
   End If
   If Check2.Checked = True then
           lstModules.Add("Module2")
   End If
   'Now load the first module and remove it from the list
   If lstModules.Size > 0 then
      Dim TheModuleToLoad as String = lstModules.Get(0)
      lstModules.RemoveAt(0)
      LoadModule(TheModuleToLoad)
   End If
End Sub

Something like this... you have to do this at the end of each module to check if there are more modules to be loaded in the list and then go there.
 
Upvote 0

Nb1320

Member
Licensed User
Longtime User
Looking at it now, I'm assuming that this needs to be put in every module to check and start it from the list, so is
B4X:
LoadModule(TheModuleToLoad)
supposed to be
B4X:
StartActivity("Module")
"Module" being the module that the code is being put into or is LoadModule supposed to be defined as something to start it?

Nevermind..I see the definition for TheModuleToLoad, just not for LoadModule. how should I define LoadModule? Thank you !
 
Last edited:
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Yes you will have to add it in every module (which I assume is an activity).

You can use StartActivity("Module") depending on how your program is structured. I just wanted to give you a generic idea.

Normally I would expect LoadModule just have if/else statements to check which activity to start.
 
Upvote 0
Top