Writing on SDCard Problem - Android
<p>I'm trying to write a file to my SDcard in my HTC Hero phone. I create the File in my SDCard using:</p>

<p>File = new File(path.getAbsolutePath(), "Filename.txt");</p>

<p>where path is the path to my externalStorageDirectory (i.e. \sdcard)</p>

<p>When I log the path of this file, it does say \sdcard\filename.txt</p>

<p>However, when I create a fileoutputstream to write to the file, suddenly the filepath is changed to \data\data and I cannot access it.</p>

<p>Can someone please help clarify how I can create a File in the SDCard and then write to it?</p>

<p>Thanks!</p>

<p>Edit:</p>

<pre><code>path = Environment.getExternalStorageDirectory();
Log.d("SDCARDPLSWORK", path.toString());
    try
    {
        myFile = new File(path.getAbsolutePath(), "SensorValues.txt");
        boolean i = myFile.createNewFile();
        Log.d("SDCARDPLSWORK", myFile.toString() + " " + i);
        fos = new FileOutputStream(myFile);
        Log.d("FILEANDROID", getFileStreamPath("SensorValues.txt").toString());
    }

    catch(FileNotFoundException e)
    {
        e.printStackTrace();
    }
</code></pre>

<p>This is what I'm doing. The part until SDCARDPLSWORK is correct, but when it comes to the FILEANDROID log it goes to the private data storage. </p>
