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.