Thursday, March 11, 2010

[android-developers] SD Card File I/O

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate