Android Question File.DirAssets and File.DirInternal - SearchView

trepdas

Active Member
Licensed User
Longtime User
what are the differences between these ?
how do I copy a file that is in dirinternal into dirassets ?



I am trying to implement the two searchviews.

my dat files (lang1.txt and lang2.txt) are in dirinternal.




B4X:
Private Sub LoadIndices
    Dim ser As B4XSerializator
    ser.Tag = 1
    ser.ConvertBytesToObjectAsync( _
        Bit.InputStreamToBytes(File.OpenInput(File.DirAssets, "lang1.txt")), "ser")
End Sub


So, firstindex and secondindex returns NULL here and therefore the Searchview is not loading :

B4X:
Sview.Initialize(Me, "Sview")
    Sview.AddToParent(SVPanel, 0, 300, SVPanel.Width, SVPanel.Height)
    If firstIndex <> Null Then Sview.LoadFirst(firstIndex)
    If secondIndex <> Null Then Sview.LoadSecond(secondIndex)



how do I move them into dirassets ?

or fix it ?

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
how do I copy a file that is in dirinternal into dirassets ?
It is not possible, The Assets are readonly.

Put the file into the Filesfolder, compile your app (the file is in DirAssets) and copy it at runtime to dirinternal if you want
 
Upvote 0

trepdas

Active Member
Licensed User
Longtime User
ah.
Thank you my savior.

so, if the files (lang1.txt and lang2.txt) are by default in the dirassets...


why does firstindex returns NULL ?
:(

I work with an emulator and not with phone. does it matter?
 

Attachments

  • tmp.jpg
    tmp.jpg
    221 KB · Views: 280
Last edited:
Upvote 0
Top