开发者

Is there a way to avoid size limit when using getResources().openRawResource()

开发者 https://www.devze.com 2023-01-21 16:24 出处:网络
I am trying to load an XML file from res/raw folder in my Android project when the app first runs. I do this with this line:

I am trying to load an XML file from res/raw folder in my Android project when the app first runs. I do this with this line:

InputStream xmlStream = getResources().openRawResource(R.raw.xmlfile);

I then want to use a SAX Parser to get data from the XML file. When doing this LogCat shows the following error:

Data exceeds UNCOMPRESS_DATA_MAX (1290892 vs 1048576)

Is there anyway around this 1MB limit?

After a few Google searches, I found people who have split their files into 1MB chunks, but these weren't XML files so I am not sure how I would rejoin them before making the InputSource for my SAX Parser.

My file is not created by me, so I can't really edit it (although I may have to) and my code work开发者_开发问答s if I retrieve it from Internet. Its around 1,300KB in size, so I want to not have to download it each time app run


Is there anyway around this 1MB limit?

Give your file an extension that will not be compressed by aapt during the build process. For example, I think it skips compressing .mp3 files.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号