我正在创建一个 5mb 左右的字典文本文件的 android 应用棋盘游戏,如何从 raw 或 assets 文件夹中读取该文件?
每当我尝试搜索字典时,我都会收到 NullPointerException。
任何有关阅读和拆分大型字典文件的建议都会有所帮助。
我正在创建一个 5mb 左右的字典文本文件的 android 应用棋盘游戏,如何从 raw 或 assets 文件夹中读取该文件?
每当我尝试搜索字典时,我都会收到 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.. 已解决..:-)