Android Question HIDE IsInitialized from class module

ArminKH

Well-Known Member
hi is there any way to change isinitialized to Private in a class module?
for example we can make any sub unreachable by add Private before each sub name
but i cant find any relevant solution for isinitialize
thanx
 

Cableguy

Expert
Licensed User
All classes, including views, have an isinitialized sub, even when the sub is not present in the code. You can try to make initialize private or even try not to have an initialize sub, but I don't think it will eliminate the isinitialized sub.
 

ArminKH

Well-Known Member
All classes, including views, have an isinitialized sub, even when the sub is not present in the code. You can try to make initialize private or even try not to have an initialize sub, but I don't think it will eliminate the isinitialized sub.
MY problem is about this thread http://www.b4x.com/android/forum/threads/create-a-child-sub-into-parent-sab.55777
i want 2 create a sub into a parent sub
after minutes i find a solution :
1-Create a class module Named A
2-Create a class module Named B
on class A we create this sub
B4X:
Sub Result as B 
End sub
and on Class be Create 2 sub like This
B4X:
Sub Male
log("male")
end sub

sub Female
log("female")
end sub
now on main activity we can
B4X:
Dim R as A
A.Result.Male
but i dont want to show Class B and Also IsInitialized
any solution?
thank u
 
Last edited:

ArminKH

Well-Known Member
Try to use a code module instead of a class
and then how is possible to add a relation between Class A and Code module B From a sub on Class mudule?
for example then we cant create a sub similar to this
B4X:
Sub Result as B
End sub
 

sonicmayne

Member
Licensed User
I'm sure you can just write:

B4X:
Private Sub IsInitialized As Boolean
    Return False
End Sub
in the class and it won't be visible outside the class.
 

ArminKH

Well-Known Member
That's a good question...

Using the 2 classes solution try this

Sub _ isinitialized

End sub
i am not sure i understand
i am begginer and my english is not good
excuse me
if is possible please explain more with details
tnx
 

ArminKH

Well-Known Member
I'm sure you can just write:

B4X:
Private Sub IsInitialized As Boolean
    Return False
End Sub
in the class and it won't be visible outside the class.
yes this is correct but please try my codes on post 3
the isinitialize is still reachable from
B4X:
R.Result.Male
 

Cableguy

Expert
Licensed User
In some code languages the leading underscore renders the sub invisible, kind of like private does.
So you could try it in your B class, just add the sub empty
 

ArminKH

Well-Known Member
Have you put the above code in both class A and B?
OOPPPS NOOO
NOW the IsInitialized not shown
and now how is possible to Hide and set unreachable Class B from Main activity?
 
Top