I need your help
I'v created ten item for customlistveiw and i'v three lable in each item now I intended to attribute some data from my database to each lable of my items but when i test my code in emulato only my item number ten shows data and rest of 9 items are empty!! here is my codes, what is my mistake and how i can show data to rest of items?
I'v created ten item for customlistveiw and i'v three lable in each item now I intended to attribute some data from my database to each lable of my items but when i test my code in emulato only my item number ten shows data and rest of 9 items are empty!! here is my codes, what is my mistake and how i can show data to rest of items?
Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim rs As ResultSet Dim cur As Cursor Dim sql1 As SQL Dim jo As JavaObject Private clv_item As CustomListView Private Label2 As Label Private Label1 As Label Private Label3 As Label End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("L_clv") Dim xui As XUI For i= 1 To 10 Dim br As B4XView= xui.CreatePanel("l") br.SetLayoutAnimated(100,0,0,100%x,50dip) br.LoadLayout("l_items") clv_item.Add(br,"") Next If sql1.IsInitialized=False Then sql1.Initialize(File.DirInternal,"pro6.db",False) End If cur=sql1.ExecQuery("SELECT * FROM tblvoc where id in (1,2,3,4.5)") For i=1 To cur.RowCount-1 cur.Position=i Label1.Text=cur.GetString("dif") Label2.Text=cur.GetString("voc") Label3.Text=cur.GetString("meaning") Label3.TextColor=Colors.Red jo.InitializeContext.RunMethod("zxc",Array As Object(Label1)) Next End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub #if java import android.widget.TextView; import android.text.method.ScrollingMovementMethod; public void zxc (TextView x) {x.setMovementMethod(new ScrollingMovementMethod());} #end if |