On Mar 14, 2012, at 9:16 AM, Nosh wrote:
> I need to create a CSV file but I am not sure which folder (if there is such 
> a thing in Android).
> 
> Is there a folder structure in Android?

There is, but only at a high level. There are three sets of directories to 
worry about:

1. /data/data/PACKAGE.NAME/files, aka $HOME, aka Context.FilesDir [0] or 
SpecialFolder.Personal [1]. This directory is private to your application, and 
should be the default location for files.

2. /data/data/PACKAGE.NAME/cache, aka Context.CacheDir[2] 
Path.GetTempPath()[3]. The contents of this directory is private to your 
application. Android may delete the contents of this directory when disk space 
is low, though as the docs note you should also limit the size of this 
directory as well.

3. /mnt/sdcard aka Environment.ExternalStorageDirectory [4]. This is the 
SDCard, and all contents are public, world readable and world writable. This is 
the preferred location for "large" files, as /data/data may be quite small, 
e.g. game data should be here.

Within each of these directories you can create as complicated a directory 
structure as you desire.

For a CSV file, I'd suggest using either [0,1], unless you can easily recreate 
the contents (e.g. it's a local cache of a remote database), in which case [2, 
3] may be appropriate. If it will be "gigantic", [4] may instead be preferable.

 - Jon

[0] http://androidapi.xamarin.com/?link=P:Android.Content.Context.FilesDir

[1] System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal):
        
http://androidapi.xamarin.com/?link=M%3aSystem.Environment.GetFolderPath(System.Environment.SpecialFolder)

[2] http://androidapi.xamarin.com/?link=P:Android.Content.Context.CacheDir

[3] http://androidapi.xamarin.com/?link=M%3aSystem.IO.Path.GetTempPath

[4] 
http://androidapi.xamarin.com/?link=P:Android.OS.Environment.ExternalStorageDirectory
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to