Android Question Accessing Classes from other Classes

Peter Lewis

Active Member
Licensed User
Longtime User
Hi, I have written my app in b4j and now I am trying to convert to b4a

In b4j I separated all the functions of the app into different classes to that it was easier to manage. That worked perfectly.

Now in b4a it does not want to work the same way. I have tried now for 2 days to get it right trying every combination and still could not get it right. So I have stripped out most of the code and the other classes. If I can get this one working then i will be able to solve the rest and learn from it.

If you have any ideas, please point me in the correct direction.

Basically I declare the class in the Global tried to use callsub to access the sub . I have tried from the one class to access the variables and objects in the other class with no luck.

I have attached the stripped down version of the app if you would like to see what i am doing wrong

Thank you
 
Last edited:

William Lancee

Well-Known Member
Licensed User
Longtime User
Add to Registraton:

B4X:
Public Sub Initialize(Parent As Object)
    chat1 = Parent
End Sub

Add to Chat:
B4X:
Public Sub Initialize(Parent As B4XView)
        registering.Initialize(Me)
        ...
End Sub

That will get you a bit further. But believe me, @Erel is 100% correct in saying that the B4XPages is the way to go. Both B4J and B4A will be one program.
It is worth the learning curve. I wouldn't use anything else anymore.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…