Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to see file in Windows Explorer while it is visible in Android file browser

Through my Android program I wrote a file like this:

String file = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Files/hello.txt";
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(str+"\n");     \\yeah string has a value there
writer.close();

Now when I go to Android's "Astro" File browser, I can see the file hello.txt in /mnt/sdcard/Files but when I mount the sdcard in Windows, I can only see 4 other files which were there in that folder but not hello.txt.

In Windows itself, I even tried to uncheck the hide hidden files option just to ensure that the file is not hidden but it's just not visible.

I even tried to write the file in root of the sdcard but again same problem. Now I'm surprised that how is it possible that I can see the file in Android but not in Windows. In Android I've even checked the file contents and everything looks fine.

What could be the problem? Is the way I'm writing the file wrong?

PS: yes the Manifest permission android.permission.WRITE_EXTERNAL_STORAGE is added.

like image 983
Atul Goyal Avatar asked Sep 12 '11 17:09

Atul Goyal


2 Answers

Ok, I figured out why it was happening. Actually even if we press "Back" button, the program keeps running and unless I go to Settings > Applications > Manage Applications > "Force Stop" <application> I can't access the file written by this program even if it is on sd card and even if the filewriter has been closed.

This is just based on my observation and I'd like someone to post a better answer with facts and with solution.

edit: I'll update my question accordingly.

edit: as recommended on meta I've posted a new question

Can't see a file in Windows written by an android app on sd-card unless I “Force Close” the app

like image 130
Atul Goyal Avatar answered Oct 17 '22 07:10

Atul Goyal


If worse comes to worst disconnect, reboot and reconnect your Android device. The files should show up then.

like image 40
Brad Avatar answered Oct 17 '22 08:10

Brad