我怎么能写从Android应用程序的Andr​​oid二进制XML?应用程序、我怎么能、Android、XML

2023-09-06 19:25:49 作者:把伤痕当酒窝ゝ

我已经得到了从Web拉XML,并在本地缓存它的应用程序。相比于Android的解析二进制XML解析XML是昂贵的,我想我的本地副本存储在Android二进制XML。我还没有发现一个API,用于动态创建的Andr​​oid二进制XML虽然通过AAPT使用的,只有C / C ++ code。

I've got an app that pulls XML from the Web, and caches it locally. As parsing XML is expensive compared to parsing Android binary XML, I'd like to store my local copy as Android binary XML. I haven't spotted an API for creating Android binary XML on the fly though, only the C/C++ code used by AAPT.

我采取这一做法的动机是,我目前不使用所有的XML值/属性,但可能需要使用更多的人在我的应用程序的未来版本,而且不希望下载所有的XML再次数据。

My motivation for taking this approach is that I don't currently use all the XML values/attributes, but may want to use more of them in a future version of my app, and don't want to download all the XML data again.

有人能指出我在API的右位在运行时创建的Andr​​oid二进制XML?

Can someone point me at the right bits of the API to create Android binary XML at run-time?

非常感谢,

菲尔Lello

推荐答案

Android的二进制XML是更快,因为它是由编译器优化。在运行时,您不能无需编译器为你做它的实现创建二进制XML。

Android binary XML is faster because it is optimized by the compiler. In runtime, you can't create binary XML without having an implementation of the compiler to do it for you.

 
精彩推荐
图片推荐