添加非Android xml文件的Android项目 [英] Adding non-android xml file to android project
问题描述
我有添加非Android的xml文件导入init.xml在Eclipse中的Android项目的问题。这个文件是用来初始化一些仿真过程中,这是不符合Android的连接。 Eclipse不承认它,如果简单地把它纳入项目目录,并喜欢写东西。
I have problems with adding a non-android xml file init.xml to android project in Eclipse. This file is used to initialize some simulation process, which is not connected with android. Eclipse doesn't recognize it if simply put it into project directory and write something like
File file = new File("init.xml");
我应该声明在一些特定的方式文件,或把它放到其他目录?
Should I declare the file in some specific way or put it into other directory?
推荐答案
您可以把资产
文件夹内的文件,然后你可以使用<一个访问该文件HREF =http://developer.android.com/reference/android/content/res/AssetManager.html相对=nofollow> AssetManager 和的 getAssets()。
You can put this file inside the assets
folder and then you can access this file by using AssetManager and getAssets().
AssetManager assetManager = getAssets();
InputStream instream = assetManager.open("init.xml");
这篇关于添加非Android xml文件的Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!