Hey folks,

I plan on using the following code to write to the SD card:

try {
    File root = Environment.getExternalStorageDirectory();
    File outFile = new File(root, "filename.ext");
    FileWriter gpxwriter = new FileWriter(gpxfile);
    BufferedWriter out = new BufferedWriter(gpxwriter);
    out.write("Hello world");
    out.close();
} catch (IOException e) {
    Log.e(TAG, "Could not write file " + e.getMessage());
}

With the plan that if an exception is triggered I will then assume
that the SD card is not available (it's missing or maybe physically
set to read only) and revert to writing to built-in memory.

Is that jumping the gun?  Do I need to do anything to the SD card
before I use it in my app?  Do I need to mount it or check whether
it's mounted or writable?  I've been having trouble finding an answer
to this in the reference docs.

Thanks!

Rob

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to