开发者

where to store the xml parsing file in an android app

I am a new developer. In my app I am trying to parse two xml files. The first xml file contains some list of data as follows:

<?xml version="1.0"?>
<Subjects>
    <Chapter>
        <chapter-name>A</chapter-name>
        <packs><pack><packname>B</packname>
        </packs>
    </Chapter>
</Subjects>

The data will be showed in a listview manner. When I touch A it moves to B, and when I touch B it moves over to the next XML file:

<?xml version="1.0"?>
<flash>
<card>
<questi开发者_StackOverflowon>shbsbdvbjj</question> 
<answer>dsbvbs</answer>
<card>
<flash>

Here I want to do a flip order; the question must be one side and the answer must be of other side.

Now the problem is that I am getting the first XML file correctly but the later one is not visible, it seems to be a black screen. I have placed both the xml files in res->raw and its beeen mentioned in the coding as:

//getting the path of xml to parse
        inputstream = this.getResources().openRawResource(R.raw.list);
resID = getResources().getIdentifier(name, "raw", "com.gis.flash");

Can anyone explain me what errors I have committed?


I don't know if its the best way to do this, but here's how you can do it. Put your xml files in the res/xml directory (you need to create it). Assuming your xml file is list.xml and it resides inside res/xml/, you can access your xml file by using getResources() like this,

getResources().getXml(R.xml.list);


put it in your asset folder and access it like file:///android_asset/yourxml.xml

i think you should see this

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜