Android Question SearchTemplate to a library

Hi, im trying put code some like this in a library

B4X:
Sub Class_Globals
    Dim base As B4XView
    Dim xui As XUI
    Dim SearchTemplate As B4XSearchTemplate
    Dim Dialog As B4XDialog
    
End Sub
Sub Search_Template(base1 As Activity) As ResumableSub
   
    basee = base1
    Dialog.Initialize (basee)
    Dialog.Title = "Departament"
           
    SearchTemplate.Initialize
    SearchTemplate.SearchField.HintText = "Search"
    SearchTemplate.SearchField.Update
   
    Dim Items As List
    Items.Initialize
   
    Items.Add("ACAROINAS")
    Items.Add("ADHESIVOS Y PEGAMENTOS")
    Items.Add("ALCOHOLES DE QUEMAR")
   
    SearchTemplate.SetItems(Items)
    SearchTemplate.Resize(90%x, 90%y)
   
    Dim rs As ResumableSub = Dialog.ShowTemplate(SearchTemplate, "", "", "CANCELAR")
    Dim cancelbtn As B4XView = Dialog.GetButton(xui.DialogResponse_Cancel)
           
    cancelbtn.Width = 120dip
    cancelbtn.Left = cancelbtn.Left - 50dip
           
    Wait For ( rs ) Complete (Result As Int)
   
    Return Result
   
End Sub

But when im use the library i get this error: java.lang.RuntimeException: java.lang.RuntimeException: Field searchfield was declared with the wrong type.
im trying learn how to create and use libraries so please bear with me
I think I am not understanding how to use objects between the program and the libraries

Thanks.
Regards.
 
Last edited:
Top