简体   繁体   中英

How to include large string array resources in an application?

I am developing a dictionary app where users can download vocabulary through an API. But I don't want to make my app look empty until they searched for their first word. So I have managed to arrange all the words with their definitions as string array and thought of displaying them as a list.

The problem here is that as I stored vocabulary with their definitions the string array gets too long that the android studio wont allow me to store such a huge number of vocabulary items in the resource array. Also by doing so the app size might increase a lot. I saw many offline dictionaries that work without downloading data on their first run. How did they achieve that ?

Any idea is appreciated. Thank you

You should create and Offline database like the SQlite database. Storing Big amounts of data in the string array is not an efficient way here.

This link may help you.

Or you can search for other offline databases.

对于离线字典,您可以将数据存储到 CSV 文件中,然后将 CSV 文件导入到您的 android studio 项目中,您可以直接从中读取内容,也可以插入到 sqlite 中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM