Don't put it in the xml/ directory. That does indeed get compiled into
a binary format, and you'd need to use the corresponding API for
reading it.

(Or you could recode to use that API, and gain efficiency and space --
but first, you'd like to test the code you've already written, right?)

So put your test.xml into the raw/ directory instead of the xml/
directory (and use R.raw.test).

More info here:
http://developer.android.com/intl/de/guide/topics/resources/providing-resources.html

And if you want to move it back and get the benefits of using the
compiled format, you'll access it starting with this API:
http://developer.android.com/intl/de/reference/android/content/res/Resources.html#getXml(int)


On Jun 30, 12:36 pm, "RespeckKnuckles (John Licato)"
<respeckknuckl...@gmail.com> wrote:
> Hey guys,
>
> I have some xml files with a custom format (based on the scxml
> specifications) that I want my program to read. I've already written
> the code to read it, but I'm running into problems actually reading
> the file itself. I want the file to be compiled with the apk, as it
> will not be changed at all during run time. So I put the file
> (test.xml) in the res/xml/ folder, and got the inputstream by using:
>
> getResources().openRawResource(R.xml.test);
>
> but when I read in this inputstream it is complete jibberish, which
> makes me suspect it is being read in binary, as openRawResource() is
> often used for binary files like images, if I am correct. What is the
> correct way to do this?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to