I have investigated this issue for some time now and I have only found really complicated solutions so I am very confused. Bear in mind that I am no expert programmer so pricier me to understand a lot relating to this!

All I wish to do is print a brand new type of figures to some text file situated within the downloads folder of the Sdcard in Android. I setup my emulator with an Sdcard and placed the written text file within the downloads folder. This bit of code is perfect for a database class which will access a text file within an Sdcard to see the information. I understand the class works outdoors of Android so think that all the techniques will work because they should to see the information!

I recieve an IOException after i run this process in another class:

public void addRecordToDataBase(ChildRecord c) throws IOException
{
    FileWriter outFile = new FileWriter("/mnt/sdcard/download/database.txt");
    PrintWriter out = new PrintWriter(outFile);
    out.println(c.printToDataBase());
    out.close();
}

The strange factor is I'm able to read in the database all right in other techniques by using their same path no problems there. I simply can't email it. I have read somewhere which you can use "regular Java techniques" to create for an Sdcard in Android without individuals crazy "OutputStream" things everywhere. Is true? I debugged this factor and discovered the type of code that's tossing the exception is appropriate here:

FileWriter outFile = new FileWriter("/mnt/sdcard/download/database.txt");

If anybody has any idea why I am geting this IOException, I'd be really grateful! Used to do try all of the crazy techniques that Android really wants to use however i think I acquired lost inside it and so i just reverted to things i understood how you can do.

Many thanks!

My prediction is that you simply can't access such directory with writing permissions, a minimum of for the reason that manner.

Have you have a look at http://developer.android.com/guide/topics/data/data-storage.html#filesExternal?

That reference and that one (http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)), explaining how getExternalFilesDir works, might be of assistance to you!

Perhaps you have declared the WRITE_EXTERNAL_PERMISSION permission inside your applications manifest file?