I was notified by one of my customers that she was unable to use the feature of my application where she is supposed to be able to send her data as an attached csv file to an email. When I run this on my emulator at home, it works. She reports that she's using the GMail client. I'm not clear on what that is. I'm using the standard way of attaching a file.
There are a couple of exceptions. I notice that other examples of attachments on the group use the SD Card to save the file before sending it. Because of the section on files in this article: http://developer.android.com/guide/topics/data/data-storage.html I chose to use the internal file storage. I do not anticipate the files my application produces ever exceeding 200 KB. So, does writing the files to internal storage only work on some phones? Should that be mentioned in the above-referenced article? It seems kind of important, since everyone seems to be using external SD Cards and not the internal memory. And, finally, here's my code, just in case I'm just making a stupid mistake somewhere. Thank you. -- private boolean sendData() { // We previously wrote the csv data to a TextView for the user to examine String msg = mMsgView.getText().toString(); // We're going to send the data as message text and/or as an attachment if (msg == null || !(mSendText.isChecked() || mSendFile.isChecked())) { Toast.makeText(this, R.string.msg_nothing_to_send, Toast.LENGTH_SHORT).show(); return false; } try { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TITLE, MSGNAME); sendIntent.putExtra(Intent.EXTRA_SUBJECT, MSGNAME); if (mSendText.isChecked()) sendIntent.putExtra(Intent.EXTRA_TEXT, msg); if (mSendFile.isChecked()) { sendIntent.setType("text/csv"); FileOutputStream fos = this.openFileOutput(FILENAME, Context.MODE_WORLD_READABLE); fos.write(msg.getBytes()); fos.close(); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(getFileStreamPath(FILENAME))); sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } else sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, getString(R.string.msg_choose_send_method))); return true; } catch (FileNotFoundException e) { Log.e(TAG, getString(R.string.title_error)); Toast.makeText(this, getString(R.string.title_error), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (IOException e) { Log.e(TAG, getString(R.string.title_error)); Toast.makeText(this, getString(R.string.title_error), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } return false; } -- 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

