I try to use  xCustomListView to show the data from database . So I have to use  CLV.clear to  update  query results , unfortunately , CLV.clear will destroy something initilized in  Activity_Create . The related data will not be shown when I use CLV_ItemClick . I don't know what the problem is , maybe I missed something .
This is my code :
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			This is my code :
			
				B4X:
			
		
		
		Sub Activity_Create(firstTime As Boolean)
    pnlPage1.Initialize("pnlPage1")
    Activity.AddView(pnlPage1,10dip,10dip,100%x,PanelHeight)
    pnlPage1.LoadLayout("cidian")
    p_initialize
End Sub
Sub p_initialize
    p.Initialize("Panel")
    pnlPage1.AddView(p,0,et.Height,pnlPage1.Width,pnlPage1.Height-et.Height)
    xml.LoadXmlLayout(p, "layout1")
    spl=xml.GetView("label1")
    spl.RemoveView
    p.AddView(spl,5dip,10dip,100%x,10%y)
    spl.TextColor=Colors.Black
    spl.TextSize=22
    sounds.Initialize(1)
    p.Visible=False
    p2.Initialize("")
    p.AddView(p2,-4dip,10%y,100%x,10%y)
    p2.LoadLayout("sound")
    Button3.Text=Chr(0xF028)
    mng=xml.GetView("label2")
    mng.RemoveView
    p.AddView(mng,5dip,20%y,92%x,p.Height-20%y)
    mng.TextColor=Colors.Black
    mng.TextSize=22
End Sub
Sub et_TextChanged (Old As String, New As String)
    Log($"EditText=${et.Text}"$)
    select_str=et.Text.Trim.ToLowerCase
    If select_str<>"" Then
        Button2.Visible=True
    Else
        Button2.Visible=False
    End If
    If SContainEnChar(select_str) Then
        CLV.Clear
        strSQL ="select spelling,concise_meaning,meaning from " & DBTableName & " where spelling like '" & select_str & "%'"
        curData=SQL1.ExecQuery(strSQL)
        For i=0 To curData.RowCount-1
            curData.Position=i
            Private spell As String=curData.GetString("spelling")
            Private mean As String = curData.GetString("meaning")
            CLV.Add(CreateListItem(spell,mean,CLV.AsView.Width,50dip),spell)
        Next
    Else If select_str="" Then
            CLV.Clear
    End If
End Sub
Sub CLV_ItemClick (Index As Int, Value As Object)
    ime.HideKeyboard
    CallSubDelayed2(Me,"Item_show",Value)
End Sub
			
				B4X:
			
		
		
		Sub Item_show(s As String)
    CLV.AsView.Visible=False
    p.Visible=True
    strSQL ="select meaning,pronunciation from " & DBTableName & " where spelling = '" & s & "'"
    curData=SQL1.ExecQuery(strSQL)
    curData.Position=0
    spl.Text=s
    mng.Text=(curData.GetString("meaning"))
    Dim pronunciation As String=curData.GetString("pronunciation")
    If pronunciation = Null Then
        Button3.Visible=False
    Else
        Button3.Visible=True
        bounceId = sounds.Load(File.DirAssets,pronunciation )
    End If
End Sub
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		