title: How do I attach a .txt file to an email?
body: <p>I am fairly new to android and I am having a problem with the email. I am trying to attach a text file to an email and send it, but when I do I get a "File too large" error. This is my first time setting up email within an application, can someone please help?</p>
  
  <p>Code:</p>
  
  <pre><code>    File myFile = new File(Environment.getExternalStorageDirectory() + "/test.txt");
      Uri uri = Uri.fromFile(myFile);
  
      Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);  
  
      String aEmailList[] = { "person@gmail.com" };    
      emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);     
      emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");  
      emailIntent.setType("plain/text");  
      emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is a test.");
      emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
  
      startActivity(emailIntent);   
  </code></pre>