Android Question StdAction Bar Question

Discussion in 'Android Questions' started by jahswani, May 27, 2015.

  1. jahswani

    jahswani Active Member Licensed User

    I'm filling dynamically the bar listIems with this routine

    Sub LoadCat
        curs = db.LoadCatz
    For i=0 To curs.RowCount-1
    Array As String(curs.GetString("categorie_name")))
        bar.SetListItems (CatArr)
    End Sub
    Call here here
    Sub Activity_Create(FirstTime As Boolean)
    Activity.SetBackgroundImage(LoadBitmap(File.DirAssets, "blue.png"))
    End Sub
    But everytime on create this fool is fired how can i prevent him from firing himself.
    Sub bar_ListItemSelected (Index As Int, Value As String)
    Log("Selected value: " & Value)
    Dim bmp As Bitmap
    Dim In1 As InputStream
    Dim buffer() As Byte     
    Dim num As Int
    For i=0 To curs.RowCount-1
    "product_name"),curs.GetString("product_sn")&"  "&MyMethods.MyCurrencyFormatWS(curs.GetString("product_price")),bmp)
           num = i+
    ToastMessageShow("Number of Records " & num,True)
    End Sub
  2. DonManfred

    DonManfred Expert Licensed User

    The sub does not call itself....

    The sub is raised multiple times. See life time circle of an activity.
  3. jahswani

    jahswani Active Member Licensed User

    Is there a solution bro
  4. Erel

    Erel Administrator Staff Member Licensed User

    Add a global boolean variable: ListItemSelectedFiredOnce. Set it to false before you set the list items. In the event sub check whether it is false or true. If it is false then ignore the event (and change it to true).
  5. jahswani

    jahswani Active Member Licensed User

    Ok thanks @Erel i will try it...
  6. jahswani

    jahswani Active Member Licensed User

    Last edited: May 28, 2015
  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