I need to write a fairly simple .csv file to the device's sdcard (so
it can then be emailed via Intent). The below code does not write the
file.

File file1 = new File(Environment.getExternalStorageDirectory(),
file_name);
FileOutputStream file_out = openFileOutput
(file_name,MODE_WORLD_READABLE);
BufferedOutputStream buf = new BufferedOutputStream(file_out);
OutputStreamWriter out_stream = new OutputStreamWriter(buf);

          // write fields in first row of spreadsheet then a new line
          for (int i = 0; i < FIELDS.length; i++)
          {
             if (i != FIELDS.length - 1)
                out_stream.write(FIELDS[i] + ",");
             else
                out_stream.write(FIELDS[i]);
          }

          out_stream.write("\n");

// more code here

I flush and close out_stream. I can even seem to be able to read from
the file on the device (printing above output, using fileinputstream,
to an edittext.

How can I get to this file on the sdcard?

Thanks!

double
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to