I think openFileOutput() method is used to write to applications private data ( not the SD card ) So your application will be searching for a folder /sdcard/ inside your applications folder "/data/...path to your application/" In order to write file you have to use FileOutputStream.
On Mar 12, 5:43 am, Pradeep <[email protected]> wrote: > Hi: > I have the following code in my application. When loaded into the > phone, I get "File Open Exception". Any idea what I may be doing > wrong? I suspect some issue with permissions or something but I'm not > sure. > > ========================= code snippet ==================== > FileOutputStream fos; > try { > fos = this.openFileOutput("/sdcard/demo.txt", > MODE_WORLD_WRITEABLE); > try { > fos.write("Appended".getBytes()); > fos.close(); > } catch (IOException e) { > // TODO Auto-generated catch block > Toast.makeText(getBaseContext(), > "File Write or Close Exception!!", > Toast.LENGTH_SHORT).show(); > e.printStackTrace(); > } > } catch (FileNotFoundException e) { > // TODO Auto-generated catch block > Toast.makeText(getBaseContext(), > "File Open Exception!!", > Toast.LENGTH_SHORT).show(); > e.printStackTrace(); > } > =================================== > > Regards...Pradeep. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

