Czy ktoś poda przykład wysyłania poczty z załącznikiem na Androida

Muszę opracować małą aplikację e-mail, którą muszę wygenerować CSV i wysłać dokument CSV za pomocą Androida. Muszę wysłać ten załącznik bez zapisywania w pamięci. Trudno mi było dołączyć plik CSV za pomocą programu do zapisu plików i mojego kodu w następujący sposób:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    buttonSend = (Button) findViewById(R.id.buttonSend);

    textTo = (EditText) findViewById(R.id.editTextTo);
    textSubject = (EditText) findViewById(R.id.editTextSubject);
    textMessage = (EditText) findViewById(R.id.editTextMessage);

    buttonSend.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

          String to = textTo.getText().toString();
          String subject = textSubject.getText().toString();
          String message = textMessage.getText().toString();

          Intent email = new Intent(Intent.ACTION_SEND);
          email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});
          //email.putExtra(Intent.EXTRA_CC, new String[]{ to});
          //email.putExtra(Intent.EXTRA_BCC, new String[]{to});
          email.setType("text/csv");
          email.putExtra(Intent.EXTRA_SUBJECT, subject);
          email.putExtra(Intent.EXTRA_TEXT, message);
        email.putExtra(Intent.EXTRA_STREAM,generateCsvFile("testdata.csv"));

          //need this to prompts email client only

          startActivity(Intent.createChooser(email, "Choose an Email client :"));

        }
    });
}
public static FileWriter generateCsvFile(String sFileName) throws IOException
   {
       FileWriter writer;
       writer = new FileWriter(sFileName);
       writer.append("DisplayName");
       writer.append(',');
       writer.append("Age");
       writer.append('\n');

       writer.append("RajeshV");
       writer.append(',');
       writer.append("26");
       writer.append('\n');

       writer.append("Mrithula");
       writer.append(',');
       writer.append("29");
       writer.append('\n');

      return writer;
    }

}

Mam problem w tej linii:

email.putExtra(Intent.EXTRA_STREAM,generateCsvFile("testdata.csv"));

questionAnswers(5)

yourAnswerToTheQuestion