0
我正在創建一個5MB左右的字典文本文件的Android應用程序棋盤遊戲,如何從原始或資產文件夾讀取此文件?如何從android原始文件夾讀取大於5mb的文本文件?
任何時候我嘗試搜索字典,我得到一個NullPointerException。
關於閱讀和分割大型字典文件的任何建議將會有所幫助。
我正在創建一個5MB左右的字典文本文件的Android應用程序棋盤遊戲,如何從原始或資產文件夾讀取此文件?如何從android原始文件夾讀取大於5mb的文本文件?
任何時候我嘗試搜索字典,我得到一個NullPointerException。
關於閱讀和分割大型字典文件的任何建議將會有所幫助。
Are You Running your App in Android Version below 2.2..
if yes then there is a limitation of 1MB max in Assets
or Raw Folder..but in later version there is no restriction
like this..so if you are able to run your code in later version
then that might be the ISSUE..i it does'nt show Nullpointer
Exception ,It show Unable To compress large Data..kind of
Exception... if this is the your can simply resolve this by
changing it to already Compress Format..these are Some Alredy
Compressed Formet DVM Does'nt compress these formet..and you
can use it,if it is Greater than !MB..
static const char* kNoCompressExt[] = { ".jpg", ".jpeg", ".png", ".gif", ".wav", ".mp2", ".mp3", ".ogg", ".aac", ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet", ".rtttl", ".imy", ".xmf", ".mp4", ".m4a", ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2", ".amr", ".awb", ".wma", ".wmv"
};所以只需將您的文件擴展名爲.txt改爲.jet ....解決.. :-)
原始資產的未壓縮大小限制爲1MB。你的文件格式是什麼?如果是基於文本的,可以考慮將它放到sqlite/FTS表中,讓sqlite爲你管理內存和索引。 – 323go 2013-02-16 01:21:24