Android Question Is the best call call from File.dirassets Um copied to the device memory and call it from them

AlfaizDev

Well-Known Member
Licensed User
Longtime User
Welcome
Is the best call call from File.dirassets
Um copied to the device memory and call it from them
What is the difference in terms of speed and performance?
Thanks
 

drgottjr

Expert
Licensed User
Longtime User
the only files you have to copy from the assets folder to internal storage
are sqlite db files (or any other random access-type resource).

the only files you need to copy from the assets folder to internal storage
are files containing data (eg, settings) which might need to be modified
and saved. the assets folder cannot be written to or accessed in a
non-sequential way.

once you copy resources from assets to the app's internal
storage area:
1) you have 2 copies of the data.
2) resources in the app's internal storage area can be read
from and written to.
3) internal storage is not visible from outside your app. (if you thought
moving a resource from assets to internal storage would allow you
to look the resource.)

note: you could also copy resources from assets to the app's
"safe" external storage area, which means you could see
the resources from your laptop/desktop. this folder is also
available for reading and writing.

once you copy a resource from assets, you do not want to
copy it again blindly everytime a user launches the app, as it will
overwrite whatever you had previously copied. (in the event you
update your app, you may well include a new set of resources
in the assets folder which you do want to copy to internal storage.
you just need to be aware of the consequences.)

i don't know if any benchmarks have been established regarding
whether reading a file from assets is faster or slower than reading
from internal storage, but since there are no moving hard drive
parts to account for (or other latency considerations), i would be
surprised if there were a consistent measurable difference.
 
Upvote 0

AlfaizDev

Well-Known Member
Licensed User
Longtime User
Good
Thank you for this information
 
Upvote 0
Top