java项目运行结果:
百度翻译引擎示例:Baidu translation engine example
android项目:
运行结果:
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from file [/src/resource/baidu.xml]; nested exception is java.io.FileNotFoundException: src/resource/baidu.xml: open failed: ENOENT (No such file or directory)a
public static String translateToEn(String q) throws Exception{
ApplicationContext container=new FileSystemXmlApplicationContext("src/resource/baidu.xml");
...略
}
在android中applicationContext可以这样初始化吗?我觉得是这里出了问题。
求助!!!!需要查看源码的请留下邮箱!
这样是找不到baidu.xml的,你可以把它放raw文件夹下,或者在软件初始化的时候先将这个文件写到手机本地存储卡上。