I believe there is only one way to create files and directories it
must be in the sd card. There are two ways to save data in files a)
via SharedPreferences and b) save in sdcard. The only other way to
save data in the phone is in the database.

If you use SharedPreferences generally speaking the data is not
available to other apps. Also if your data in the XML file is large it
is better to save it in the sd card.
Developers are not following any standard(rather common sense) in
creating files and directories. Most developers, including some google
employees create app name directory in the root of sd card. I think
the best way is to create directory like this "/sdcard/
com.google.android.apps.listen". I have been doing like this "/sdcard/
com/myco/myapp" and I am going to change my practice :-).

You can use regular Java file API classes to create and access files.
You will have to make sure that you set user permission for writing
into the file in your manifest file. Other important thing is obtain
the root of the "/sdcard" using API calls and do not hard code it.

--dipu





On Apr 22, 11:03 am, Tommy <droi...@gmail.com> wrote:
> Hi,
>
> I am trying to find the best way to save files to the phone. Basically
> I have an XML file on a web server that I would like to be able to
> save on the phone. Should I create a specific folder in my project to
> save to and if so how do I save the file. Or should I make it to where
> when you click the Save button it checks for an SD card and if there
> is and SD card create a folder(if one isn't already there) and save
> the file in the new folder or save it to the phone?
>
> If someone could explain the most efficient way of saving files for my
> app and how to save the file from the web server I would greatly
> appreciate the insight. Any tutorial links would be awesome.
>
> Thanks!!
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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