Android Question how can i unload layout ?

Discussion in 'Android Questions' started by Waldemar Lima, Feb 6, 2018.

  1. Waldemar Lima

    Waldemar Lima Member Licensed User

    hi everyone !

    how can i unload layout without "Re"load back side ?


    like this screenshot >
    this buttons are loades on "front" of Gmaps , how can i unload this buttons layout without reload gmaps layout ?

    http://prntscr.com/ib0ys3
     
  2. NJDude

    NJDude Expert Licensed User

    Just change the buttons visibility, for example:
    Code:
    Button1.Visible = False
     
  3. Waldemar Lima

    Waldemar Lima Member Licensed User

    it will set buttons "disabled" too ?
     
  4. Waldemar Lima

    Waldemar Lima Member Licensed User

    this dont works :c

    Code:
    Sub Globals
        
    Private gmap As GoogleMap
        
    Private MapFragment1 As MapFragment
        
    Private Button1 As Button
        
    Private Button2_n As Button
        
    Private Button3_n As Button
        
    Private Button4_n As Button
        
    Private bmp As Bitmap
        
    Private cp As CameraPosition
        
    Private MenuIsVisible As Int
        
    End Sub

    Sub Button1_click
        Button2_n.Visible = 
    True ' error = -- java.lang.RuntimeException: Object should first be initialized (Button).
    End Sub

    Sub Button2_n_click

    End Sub

    Sub Button3_n_click

    End Sub

    Sub Button4_n_click

    End Sub


    Sub Activity_Create(FirstTime As Boolean)
        
        bmp = LoadBitmapResize(
    File.DirAssets, "bus_stop_point.png"32dip32dipTrue)
        
    Activity.LoadLayout("1")
        
        
    If MapFragment1.IsGooglePlayServicesAvailable = False Then
            
    ToastMessageShow("Please install Google Play Services."True)
        
    End If
        
    Dim width = Activity.Width
        
    Dim height = Activity.Height
        
        
    Log("width = "&width)
        
    Log("height = "&height)
    End Sub
     
  5. NJDude

    NJDude Expert Licensed User

    Dude, those buttons events should be after Activity_Create, and after you load your layout.
     
  6. Waldemar Lima

    Waldemar Lima Member Licensed User

    like this >

    Code:
    Sub Globals
        
    Private gmap As GoogleMap
        
    Private MapFragment1 As MapFragment
        
    Private Button1 As Button
        
    Private Button2_n As Button
        
    Private Button3_n As Button
        
    Private Button4_n As Button
        
    Private bmp As Bitmap
        
    Private cp As CameraPosition
        
    Private MenuIsVisible As Int
        
    End Sub


    Sub Activity_Create(FirstTime As Boolean)
        
        bmp = LoadBitmapResize(
    File.DirAssets, "bus_stop_point.png"32dip32dipTrue)
        
    Activity.LoadLayout("1")
        
        
    Do While Activity.IsInitialized = False
            Sleep(
    100)
        
    Loop
        
        
    If MapFragment1.IsGooglePlayServicesAvailable = False Then
            
    ToastMessageShow("Please install Google Play Services."True)
        
    End If
        
    Dim width = Activity.Width
        
    Dim height = Activity.Height
        
        
    Log("width = "&width)
        
    Log("height = "&height)
    End Sub

    Sub Button1_click

        Button2_n.Visible = 
    True
    End Sub

    Sub Button2_n_click

    End Sub

    Sub Button3_n_click

    End Sub

    Sub Button4_n_click

    End Sub
     
  7. Jeffrey Cameron

    Jeffrey Cameron Active Member Licensed User

    I'm pretty sure the order of the procedures in the code is irrelevant (aesthetics aside). What is relevant, is that you're certain that the "Button2_n" name you've given the button in Globals is the same name you have specified in your "1.bal" file?
     
  8. Jeffrey Cameron

    Jeffrey Cameron Active Member Licensed User

    Additionally, if you have multiple buttons you wish show/hide at the same time, I would recommend creating a panel and adding the panel to the activity. Then you can put the UI layout inside the panel and show/hide the entire panel at once rather than doing each individual button.
     
    jnjft likes this.
  9. jnjft

    jnjft Member Licensed User

    Right - I tried it, a Sub is found anywhere you put it in the code.
     
  10. Waldemar Lima

    Waldemar Lima Member Licensed User

    i found a error !!!
    i only set Button2_n to " EventName" not in "Name" too xD

    thanks All by help :D
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice