Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have an XML file that is as follows:

<string-array name="Cube_type_entries">
    <item>2x2x2</item>
    <item>3x3x3</item>
    <item>4x4x4</item>
    <item>5x5x5</item>
    <item>6x6x6</item>
    <item>7x7x7</item>
    <item>8x8x8</item>
    <item>9x9x9</item>
    <item>Pyraminx</item>
    <item>Megaminx</item>
    <item>Clock</item>
</string-array>
<string-array name="Cube_type_values">
    <item>x2</item>
    <item>x3</item>
    <item>x4</item>
    <item>x5</item>
    <item>x6</item>
    <item>x7</item>
    <item>x8</item>
    <item>x9</item>
    <item>Pyraminx</item>
    <item>Megaminx</item>
    <item>Clock</item>
</string-array>

(It has the resource tag, and the other stuff needed)

And, I would like to add an item to Cube_type_entries, so a user could customize what he would like in it. So, the user hits an Enter button, I have the code for that, but I do not know how to insert it into the string-array then save it. (I am not looking for a dynamic one, I simply want it to be able to save it to the table every now and then)

So, how do I add to an XML string-array and then save it in Java?

share|improve this question
    
You can't modify the resource xmls AFAIK. –  A--C Jan 4 '13 at 18:47
    
You can make use of File Operation, but I am not sure thats how you wanted. –  Smit Jan 4 '13 at 18:48
1  
What I need is the Java code to insert and save something no, this is not how SO works, here you should ask question, not post your requirements. –  Pradeep Simha Jan 4 '13 at 18:48
    
@Swapnil I haven't found anything I could try. –  DXPower Jan 4 '13 at 18:49
    
@Pradeep Simha That is my question. I just put it in a statement. Just to summarize, how I should have put it: How do I insert something to XML string-array then save it? I will change that. –  DXPower Jan 4 '13 at 18:50
show 1 more comment

1 Answer 1

you could load your xml into objects, I think simpleXML is a library you can use with android.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.