Android Question [CLOSED] Passing Views to a service using lists ?

Discussion in 'Android Questions' started by lemonisdead, Jan 22, 2015.

  1. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Hello,

    I am asking the question because of the idea of @DonManfred about removing a view from a service and his warning about me adding another view again and again.

    So, aware of the fact I couldn't declare views from as Process_Globals, I have tried to use lists : a Globals list to add the created view and a Process_Globals one to add the view got from the previous list.

    Like this :

    Code:
    Sub Process_Globals
        
    Dim L1 As List
    End Sub

    Sub Globals
        
    Dim mView As Label
        
    Dim L As List
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    If Not(L.IsInitialized) Then L.Initialize
        
    If Not(L1.IsInitialized) Then L1.Initialize

        
    If FirstTime Then
            mView.Initialize(
    "")
            mView.Text= 
    "Some text"
            L.Add(mView)
            L1.Add(L.Get(
    0))
        
    End If

    End Sub
    Then on a service I think I can get the reference to the view

    Code:
    Sub AddOverlay
        
    Dim mView As Label
        mView.Initialize(
    "")
        mView=Main.L1.Get(
    0)
        ...
    End Sub
    This works. But could you please, tell me if I am really getting a reference to the View that I had declared in the Main Globals ? (This to be able to study how to use removeView later).

    Many thanks
     
  2. lemonisdead

    lemonisdead Well-Known Member Licensed User

    CLOSED : the method really works great
     
    Informatix likes this.
  3. Informatix

    Informatix Expert Licensed User

    Maybe you could put all of this in the Code Snippets section of the forum.
     
    lemonisdead likes this.
  4. lemonisdead

    lemonisdead Well-Known Member Licensed User

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