I have following fragment of code, where I need to pass the ID field (Row ID) from ListView to another activity
(which displays the record details as form). How would I read and pass ID column ?
I want to use regular RowClick event to start
The table structure looks like this
Arthur
(which displays the record details as form). How would I read and pass ID column ?
B4X:
Sub Activity_Create(FirstTime As Boolean)
SQL1.Initialize(Main.dbFileDir, Main.dbFileName, True)
Activity.LoadLayout("DiseasesListView")
QueryString = "SELECT DiseaseID, ComonName, ComonSubname FROM "& dbTableName &" ORDER BY ComonName"
Activity.Title = "DISEASES"
FillListView
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ListViewInit
ListView1.SingleLineLayout.ItemHeight = 40dip
ListView1.SingleLineLayout.Label.Left = 0
ListView1.SingleLineLayout.Label.Width = 100%x
ListView1.SingleLineLayout.Label.Height = 40dip
ListView1.SingleLineLayout.Label.Gravity = Gravity.CENTER_VERTICAL
ListView1.SingleLineLayout.Label.Color = Colors.White
ListView1.SingleLineLayout.Label.TextSize = 12
ListView1.SingleLineLayout.Label.TextColor = Colors.Black
ListView1.FastScrollEnabled = True
End Sub
Sub FillListView
ListView1.Clear
Cur = SQL1.ExecQuery(QueryString)
For i = 0 To Cur.RowCount - 1
Cur.Position = i
ListView1.AddSingleLine(Cur.GetString("ComonName"))
Next
' cur.Close
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
StartActivity(DiseaseFormView)
End Sub
I want to use regular RowClick event to start
B4X:
StartActivity(DiseaseFormView)
The table structure looks like this
B4X:
CREATE TABLE "dDISEASES" ("DiseaseID" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,"ComonName" CHAR(80) NOT NULL ,"ComonSubname" CHAR(40) NOT NULL ,"MedicalName" CHAR(80) NOT NULL ,"LatinName" CHAR(80) NOT NULL ,"OtherName" CHAR(80) NOT NULL ,"Description" TEXT NOT NULL ,"Falg" SMALLINT NOT NULL ,"Locked" SMALLINT NOT NULL ,"lang" CHAR(2) NOT NULL ,"Operator" INT NOT NULL , "LastUpdate" DATETIME)
Arthur