Thanks for the information.  I just write configuration to a ini
settings file so I can read them back the next time the application
starts and just wanted to make sure they're being set correctly.  This
seems a little to much work to just view an ini file (not your fault).
I was just hoping to do a notepad view of the file.  I'll just add a
debug button to read the contents and display them for now.

Thanks.  

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jonathan Pryor
Sent: Saturday, July 30, 2011 2:56 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] File viewer

On Jul 26, 2011, at 4:08 PM, Tim Kelly wrote:
> Ok, this might to oblivious, but I cannot seem to be able to figure it
out.  My application writes information to a file, so I want to view the
contents of that file.  So how do you view files in the emulator??

The app that created the file can view the file. By default, only the
creating app can read files in the app's directory.

If you're on the emulator, `adb shell` has root access, and thus can
view ~everything, so you could use `adb shell cat /path/to/file` to view
the contents of a file. This won't work on a non-jailbroken device,
though.

If you want other apps to view the file, or you want to be able to view
the file on non-jailbroken hardware, you need to place it into a
directory that other apps can read. You can do this either via:

 1. Context.GetDir(string,FileCreationMode)[0] with
FileCreationMode.WorldReadable to allow others to read the directory.
This should create a directory under /data/data/@PACKAGE_NAME@/files,
and if other apps (and/or you) know the full path you should be able to
read the directory contents.

 2. Placing your file into an "external" directory, via
Context.GetExternalFilesDir()[1] or Environment.ExternalStorageDirectory
[2].

 - Jon

[0]
http://docs.mono-android.net/Android.Content.Context.GetDir%20(string,%2
0Android.Content.FileCreationMode)

[1]
http://docs.mono-android.net/Android.Content.Context.GetExternalFilesDir
%20(string)

[2]
http://docs.mono-android.net/Android.OS.Environment.ExternalStorageDirec
tory
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]

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

Reply via email to