Android Question SearchView question file.dat

gregorio_adrian_gimenez

Active Member
Licensed User
sorry to ask this question, maybe it's very basic
I don't know how to replace existing files on searchview so you can use a flat txt file that contains country names.
who can help me? I don't understand this from the index and files.dat
B4X:
Private Sub LoadIndices
    Dim ser As B4XSerializator
    ser.Tag = 1
    ser.ConvertBytesToObjectAsync(Bit.InputStreamToBytes(File.OpenInput(File.DirAssets,"first.dat")),"ser")
    
    

End Sub

Private Sub ser_BytesToObject (Success As Boolean, NewObject As Object)
    Log(NewObject)
    ProgressBar1.Visible = False
    If Success Then
        Dim ser As B4XSerializator = Sender
        Log($"BytesToObject: ${ser.Tag}"$)
        If ser.Tag = 1 Then
            firstIndex = NewObject
            sv.LoadFirst(firstIndex)
            ser.Tag = 2
            'read the secondary index
            ser.ConvertBytesToObjectAsync( _
                Bit.InputStreamToBytes(File.OpenInput(File.DirAssets, "second.dat")), "ser")
        Else if ser.Tag = 2 Then
            secondIndex = NewObject
            
                    End If   
    End If
End Sub
 

Erel

Administrator
Staff member
Licensed User
You are using code from the more complex example that shows how to load large files asynchronously.
In most cases you should use the simpler option:
B4X:
SearchView.SetItems(File.ReadList(your text file))
 
Top