Android Question StdAction Bar Question

jahswant

Well-Known Member
Licensed User
I'm filling dynamically the bar listIems with this routine

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

DonManfred

Expert
Licensed User
prevent him from firing himself.
The sub does not call itself....

The sub is raised multiple times. See life time circle of an activity.
 
Upvote 0
Top