Android Question HIDE IsInitialized from class module

Discussion in 'Android Questions' started by ArminKH, Jul 2, 2015.

  1. ArminKH

    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
     
  2. Cableguy

    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.
     
  3. ArminKH

    ArminKH Well-Known Member

    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
    Code:
    Sub Result as B 
    End sub
    and on Class be Create 2 sub like This
    Code:
    Sub Male
    log("male")
    end sub

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

    Cableguy Expert Licensed User

    Try to use a code module instead of a class
     
    lemonisdead and ArminKH like this.
  5. ArminKH

    ArminKH Well-Known Member

    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
    Code:
    Sub Result as B
    End sub
     
  6. Cableguy

    Cableguy Expert Licensed User

    That's a good question...

    Using the 2 classes solution try this

    Sub _ isinitialized

    End sub
     
    ArminKH likes this.
  7. sonicmayne

    sonicmayne Member Licensed User

    I'm sure you can just write:

    Code:
    Private Sub IsInitialized As Boolean
        
    Return False
    End Sub
    in the class and it won't be visible outside the class.
     
    ArminKH likes this.
  8. ArminKH

    ArminKH Well-Known Member

    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
     
  9. sonicmayne

    sonicmayne Member Licensed User

    In Class module A and B you have made put the above code into both, and IsInitialized will disappear from the list of available methods.
     
    Cableguy and ArminKH like this.
  10. ArminKH

    ArminKH Well-Known Member

    yes this is correct but please try my codes on post 3
    the isinitialize is still reachable from
    Code:
    R.Result.Male
     
  11. Cableguy

    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 likes this.
  12. sonicmayne

    sonicmayne Member Licensed User

    Have you put the above code in both class A and B?
     
    ArminKH likes this.
  13. ArminKH

    ArminKH Well-Known Member

    OOPPPS NOOO
    NOW the IsInitialized not shown
    and now how is possible to Hide and set unreachable Class B from Main activity?
     
  14. sonicmayne

    sonicmayne Member Licensed User

    Do you mean so you can't do something like:

    Code:
    Dim B As B
    in Main?

    If so, i'm not entirely sure.
     
    ArminKH likes this.
  15. ArminKH

    ArminKH Well-Known Member

Loading...