Hi,

I get the following exceptions (from my users) when I try to open a
fileoutputstream:

phone model: GT-I5800, android version: 2.1-update1, exception:
java.io.FileNotFoundException: /sdcard/MYPATH/FILENAME
       at
org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:
244)
       at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
       at java.io.FileOutputStream.<init>(FileOutputStream.java:69)


phone model: PC36100, android version: 2.2, exception:
java.io.FileNotFoundException: /mnt/sdcard/MYPATH/FILENAME  (Invalid
argument)
       at
org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
       at
org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:
152)
       at java.io.FileOutputStream.<init>(FileOutputStream.java:97)

MYPATH and FILENAME are variables and they looks good. For example:
"widgets" for MYPATH and "4x1_Standart" for FILENAME

My code is the following:

        String state = Environment.getExternalStorageState();

        if (Environment.MEDIA_MOUNTED.equals(state)) {
                File folder = new 
File(Environment.getExternalStorageDirectory(),
folderName);

                if (!folder.exists()) {
                        folder.mkdirs();
                }

                FileOutputStream fos = new FileOutputStream(file);     // I get 
this
exception here
        }


What is wrong? Should I check something else?

It works well on my phone, so I don't know why these errors occur.

Thanks,
Tamás

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to