Java 从资产检索数据时InputSource在Android中不工作?

Java 从资产检索数据时InputSource在Android中不工作?,java,android,xml,dom,assets,Java,Android,Xml,Dom,Assets,在检查其他问题的答案并将其应用到我的程序中之后,我仍然无法从项目中加载资产 下面是有问题的代码块,它似乎没有越过带有注释//BUG的行 public void parseXmlFile(String xml_file, String object, String xml_class, String pointer, Activity activity, TextView test) throws ParserConfigurationException, SAXException, I

在检查其他问题的答案并将其应用到我的程序中之后,我仍然无法从项目中加载资产

下面是有问题的代码块,它似乎没有越过带有注释//BUG的行

    public  void parseXmlFile(String xml_file, String object, String xml_class, String pointer, Activity activity, TextView test) throws ParserConfigurationException, SAXException, IOException{

    view = test;

    view.setText("2.1");
    categories_list = new ArrayList<Category>();

    //instantiate String object sto be used throughout class
    object_name = object;
    class_type = xml_class;
    value_pointer = pointer;


    //get factory
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();


    //get instance of document builder to build document from xml file
    DocumentBuilder builder = factory.newDocumentBuilder();



    //Create bytestream which allows a stream of data from xml to document builder
    ByteArrayInputStream byte_stream = new ByteArrayInputStream(xml_file.getBytes("utf-8"));


    //create an input source for the bytestream
    InputSource input_src = new InputSource(activity.getAssets().open(xml_file));

    dom = builder.parse(input_src); //BUG

    parseDocument();

    byte_stream.close();
}
我的XML在assets文件夹中,应用程序没有崩溃,只是没有做任何事情。我应该得到的响应是从XML解析中得到的按钮列表视图。解析XML的算法已经在普通Java应用程序中进行了测试。我只想把它应用到Android应用程序上


如果您想了解更多信息,请发表评论。

我正在手机上测试,因为模拟器很糟糕。手机仍然有一个logcat