Android Question Search View class building index

apiwatcomscith

Member
Licensed User
Hello guys,
I'm using Search View for create Project It work my Project is Dictionary it will calling data from database and calling ok no problem but started application it building index to very long time .
how to I should .... note : is database sqlite is a big file about 13 MB and 8x,xxx record


thank you all.
 

apiwatcomscith

Member
Licensed User
Make sure to test it in release mode. However building an index for 80k records will be slow.

You can try to change MIN_LIMIT and MAX_LIMIT.
Hi, Sir I'm change MIN and MAX_LIMIT this Without any effect and compile to release have a faster a little , this problem me should how to it.
thank you
 

apiwatcomscith

Member
Licensed User
You can use RandomAccessFile.WriteObject to write the object returned from sv.SetItems. You can then take this file from the device and add it to your project.
Hello Sir , I'm create object file and copy from device to Project but how to use it ,or replace old sqlite ? now I'm test it with calling object file and using replace index variable (index as object) it now work, I'm lost.

Thank you for Reply

this code section for calling object file
B4X:
If File.Exists(File.DirInternal, "index_lex.dat") Then
            File.Copy(File.DirAssets, "index_lex.dat", File.DirInternal, "index_lex.dat")
            ar.Initialize(File.DirInternal,"index_lex.dat",False)
            File.Copy(File.DirAssets, "index_lex.dat", File.DirInternal, "index_lex.dat")
        Else
            ar.Initialize(File.DirInternal,"index_lex.dat",False)
        End If

and using
B4X:
    Dim cities As List
        cities.Initialize
       
        cursor1 = sql1.ExecQuery("SELECT * FROM eng2thai") 

        Dim Row,RowNumber As Int
        If cursor1.RowCount > 0 Then                        'check if entries exist
            RowNumber = cursor1.RowCount                    'set the row count variable
        For Row = 0 To  RowNumber - 1
              cursor1.Position = Row                        'set the Cursor to each row
              cities.Add(cursor1.GetString("esearch"))
        Next
            Else
                ToastMessageShow("No items found", False)
            End If
        '****read object ***
        'Dim list2 As List
           cities = ar.ReadObject(ar.CurrentPosition)
           Log(cities)
          ar.Close
        '***************
        index = sv.SetItems(cities)
 
Top