1

Im working on Android. My android application successfully creates a text file in SD card memory; the created text file can be seen in the DDMS explorer but cannot be seen in the windows explorer. Here is my code:

private void initFile(String filename, char[] data, int length){

       File File = new File(Environment.getExternalStorageDirectory() + File.separator + "Download" + File.separator + filename);

       try {
           File.delete();
           File.createNewFile();

           FileOutputStream fOut = new FileOutputStream(mFile);
           OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);

           if(mFile.exists())
           {
               myOutWriter.write(data,0,length);
               myOutWriter.flush();
               myOutWriter.close();
               fOut.close();
           }

       } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }



   }

Note: But if I restart the android the created text file can be seen already in the windows explorer.

You have any idea why is it so? Why the file cannot be seen in the windows explorer when it is created in android when it can be seen in the DDMS?

Im using real android tablet.

tinks
  • 323
  • 1
  • 5
  • 21

1 Answers1

1

You have to pull the file from DDMS File Explorer to Windows File Explorer. You have to select the file on the DDMS File Explorer and then click the button pull a file from the device present at the right side of the DDMS File Explorer Window and save it in any of the folder on your wish. After that you can see it in Windows FileExplorer

Chandra Sekhar
  • 18,914
  • 16
  • 84
  • 125
  • yes,I can pull the file from DDMS but my requirement is not to use the DDMS, I just need to click on the icon in the Mycomputer and explore the android external memory. But when I do that the text file created is not there. – tinks Apr 16 '12 at 09:16
  • @tinks Well I am not an expert on this, but I think it is not possible, because both are complete different platforms. – Chandra Sekhar Apr 16 '12 at 09:19
  • oh ok.. but because when I restart the android the created file can be seen already in the windows explorer without pulling it from DDMS.. – tinks Apr 16 '12 at 09:26