-2

I have an aplication that have to keep some information on the mobile i decided to use generate xml every time and save it on a file of my project.

How can i create a XML and save it on a file of my project onClickEvent?

1 Answers1

0

Please, look a this documentation: Storage Options
It explains pretty clearly how to write into a file.

Then, I recommend you to use "JSON" instead of "XML" because it's easier to use. Add your datas in a JSONObject and write your JSONObject in the file using myJsonObject.toString().

For taking back, read your file content and parse it in a new JSONObject like that:
JSONObject jsonDatas = new JSONObject(fileContent);

Allan Mermod
  • 806
  • 1
  • 8
  • 16