is it possible to create xml file through android applicatio

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

is it possible to create xml file through android applicatio

Postby abhilash » Fri Mar 07, 2008 10:09 am

hi
can any one help in creating xml file in android application.....................
its like i should write a program and it should create an xml file... and store in the phone memory ........ pls help .....
urgent.............
abhilash
Developer
Developer
 
Posts: 26
Joined: Fri Feb 22, 2008 11:21 am
Location: HYDERABAD

Top

Postby plusminus » Fri Mar 07, 2008 1:12 pm

Hello abhilash,

the simpliest way of doing so is this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                FileOutputStream fOut = openFileOutput("samplefile.xml",
  2.  
  3.                                         MODE_WORLD_READABLE);
  4.  
  5.                OutputStreamWriter osw = new OutputStreamWriter(fOut);
  6.  
  7.  
  8.  
  9.                osw.write(YOUR_XML_CODE);
  10.  
  11.                osw.flush();
  12.  
  13.                osw.close();
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

didnt get

Postby abhilash » Fri Mar 07, 2008 1:21 pm

hi plusminus

i am not having samplefile.xml ......... does(android application) it create by it self ............ if it creates whre does it stores ..........pls help
abhilash
Developer
Developer
 
Posts: 26
Joined: Fri Feb 22, 2008 11:21 am
Location: HYDERABAD

Postby plusminus » Fri Mar 07, 2008 3:06 pm

Hello

yes, if it didn't exists, it gets created.
Files are stored at: /data/data/your_project_package_structure/files/

:idea: More info: viewtopic.php?t=115

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests