Label1.Tag = "Label1"
For i = 0 To Activity.NumberOfViews - 1
If Activity.GetView(i).Tag = "Label1" Then
End If
Next
'This does not work!!
Sub fillpagefromdb
Dim Cursor1 As Cursor,name As String,value As String,o As View
Cursor1 = db.sql1.ExecQuery("SELECT * FROM table1")
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
name=Cursor1.GetString("name")
value=Cursor1.GetString("data")
o=GetObjectFromTag(name)
If (o) Then o.text=value
Next
Cursor1.Close
End Sub
Sub GetObjectFromTag(a As String) As View
Dim o As View
o=Null
For i = 0 To Activity.NumberOfViews - 1
If Activity.GetView(i).Tag = a Then
o=Activity.GetView(i)
Continue
End If
Next
Return o
End Sub
If (o) Then o.text=value
Sub fillPageFromDb
Dim Cursor1 As Cursor,name As String,data As String
Cursor1 = db.sql1.ExecQuery("SELECT * FROM table1")
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
name=Cursor1.GetString("name")
data=Cursor1.GetString("data")
Select name
Case "label1"
Label1.Text=data
Case "titel"
Label2.text=data
End Select
Next
Cursor1.Close
End Sub
What does not work ?
This line looks strange to me :Perhaps I'm wrong, never tried this.B4X:If (o) Then o.text=value
But without knowing what is not working I don't want to spend much time to guess what could be wrong.
Don't you have a small test project to test it ?...