Skip to content Skip to sidebar Skip to footer

Writing To File Not Working In Android

I am trying to write to a text file in Android. My code is as follows (running in a Service): File log; String state = Environment.getExternalStorageState();

Solution 1:

If it's a real device (not AVD), then I think it's plugged into your computer via USB. Some settings doesn't allow to browse external storage while it's plugged to a computer. Unplug it, and look for the file.


Solution 2:

i have rooted 4.2.1 GNexus and here's how i find that 'External' directory for 'Movies'...

127|shell@android:/storage # busybox find . -type l   // list symlinks in /storage                          
./sdcard0
./emulated/legacy
shell@android:/storage # ls -l sdcard0      // list the symlink for SDCRD

lrwxrwxrwx root     root              2013-02-12 06:57 sdcard0 -> /storage/emulated/legacy

shell@android:/storage # ls -l /storage/emulated/legacy  // follow it                        
lrwxrwxrwx root     root              2013-02-12 06:57 legacy -> /mnt/shell/emulated/0

shell@android:/storage # ls -l /mnt/shell/emulated/0                           

...
drwxrwxr-x root     sdcard_rw          2012-11-14 10:56 Alarms
drwxrwxr-x root     sdcard_rw          2012-11-14 10:56 Android
drwxrwxr-x root     sdcard_rw          2012-12-13 16:58 DCIM
drwxrwxr-x root     sdcard_rw          2013-02-05 14:29 Download
drwxrwxr-x root     sdcard_rw          2013-01-19 03:30 Evernote
drwxrwxr-x root     sdcard_rw          2013-01-10 14:17 LazyList
drwxrwxr-x root     sdcard_rw          2013-02-13 08:57 Movies
drwxrwxr-x root     sdcard_rw          2013-01-14 09:15 Music
drwxrwxr-x root     sdcard_rw          2012-11-14 10:56 Notifications
drwxrwxr-x root     sdcard_rw          2013-02-13 08:57 PictureComment
drwxrwxr-x root     sdcard_rw          2013-02-13 08:57 Pictures
drwxrwxr-x root     sdcard_rw          2012-11-14 10:56 Podcasts


ls -l /mnt/shell/emulated/0/Movies/                                                    <
-rw-rw-r-- root     sdcard_rw   517984 2012-12-31 14:53 20121231110404.mp4
-rw-rw-r-- root     sdcard_rw   937716 2013-01-02 13:32 20130102133041.mp4
-rw-rw-r-- root     sdcard_rw        0 2013-01-06 18:20 20130106181851.mp4
-rw-rw-r-- root     sdcard_rw  1015604 2013-01-10 14:17 20130110141521.mp4
-rw-rw-r-- root     sdcard_rw   310100 2012-12-13 16:57 me-2139628341.mp4
-rw-rw-r-- root     sdcard_rw   212589 2012-12-10 09:40 me-813905104.mp4
-rw-rw-r-- root     sdcard_rw   387913 2012-12-10 10:43 me-827018151.mp4
-rw-rw-r-- root     sdcard_rw   204403 2012-12-10 10:39 me-902796538.mp4
-rw-rw-r-- root     sdcard_rw   796636 2012-12-29 12:25 me-999888777.mp4
-rw-rw-r-- root     sdcard_rw   297690 2013-02-13 08:57 me115420782.mp4

Post a Comment for "Writing To File Not Working In Android"