Android Question How do I declare and use a B4XPage Subs/Vars in a Service module?

anasazi

Member
I can't seem to figure out what is wrong with this example. I added a service module to the B4XPages ThreePagesExample. I added an additional Pag4 just to test my wits, that all worked fine. But now I added a BLEservice module to the mix. The problem I'm having is that I can't get this service module to access Subs and Vars in a B4XPages object. You can see from, the declaration that isn't in error but then I try to initialize and define the object the B4A compiler make them RED as an error indicator. How do I do this correctly?
The 'B4XPages Booklet" keeps stating how easy it is to access var's and subs in other pages, but not a bunch of detail on Pages and Service modules interactions. I'm sure this is an easy one for any of you more experienced than me to solve. I couldn't find an example or forum issue dealing with this exact thing.
I transfered my problem to the genaric example code, so the Subs I'll be calling back to are not in this example. But the main issue is just decalring the object in the Service module and then accessing the Subs and var's the objects on that B4XPage from the Service module. (Worked nicely when I was all Activity type page code).
Thanks in advance, MY

 

Attachments

  • Project.zip
    195.1 KB · Views: 59

anasazi

Member
Hi, I was simply following how the BLE2 example was setup. I was an 'activity' type and
used a service to keep the BLE driver going I guess. Porting that to a Pages type of application
is what I'm doing. Right, the doc's do say Pages are not paused, so I guess moving that BLE2
callback Sub's to a Page module is possible with out missing BLE events. Will try! Thanks Erel!
 
Upvote 0

anasazi

Member
Ok, great, I merged the service module code into my scan page and it is fine now.
This wasn't obvious to me as a way to do this with out using the service module method.
Experience of 'doing' trumps the experience of an initial reading of the manual sans any 'doing'!
Thanks for the pointer Erel!
Marc
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…