我怎么能写从Android应用程序的Andr​​oid二进制XML? [英] How can I write android binary XML from Android App?

查看:137
本文介绍了我怎么能写从Android应用程序的Andr​​oid二进制XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了从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.

这篇关于我怎么能写从Android应用程序的Andr​​oid二进制XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆