• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem saving *.TXT file

hlustosa

Lurker
I'm a begginer Android Developer, and I'm trying to deploy a simple App which writes a .Txt file on the SDCARD.

But every time I try to do so, I get this permission denied error message.

Here's the code:

File file = new File(Environment.getExternalStorageDirectory(), "test.txt");

if( file.createNewFile())
{
FileWriter fw = new FileWriter(file);
fw.write(text);
fw.close();
}






I've already added
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">


to the Manifest, but I still receive this error message. I'm using the eclipse, and the emulator that comes with the SDK. But I was using a Android mobile, and I got the error as well.

Does anyone know what else should I try. Because I was searching the net, and all I found was people saying to add the permision to the manifest.

Using android 1.5 on the phone (API level 3). And android 2.2 on the emulator.
 
That should do the trick. Have you placed the uses-permission tag as a child of the manifest-tag (so not in application or what so ever?)
 
Back
Top Bottom