How to set file attachment in android
<p>I am creating a file and then sending it as  attachment mail in background from my app.All is working fine mail sending is done successfully but issue is here that while creating file i named it as abc.csv and it file stored in dir with this name but when i got the attachment then it is named as <strong>&lt;&lt;_mnt_sdcard_MyTest_abc.csv>></strong>. Here is the code which i am using to get the attachment. </p>

<pre><code> private boolean SendMail() {
  boolean result=false;
  txtAdd=(EditText)findViewById(R.id.txtAdd);
  File folder;
        folder = new File(Environment.getExternalStorageDirectory() + File.separator
              + getString(R.string.app_name));
     boolean var = false;
        if (!folder.exists())
            var = folder.mkdir();
  Mail m = new Mail("abc@gmail.com", "*****"); 
  //String[] toArr = {EmailFetcher.getEmail(this)}; 
  String[] toArr = {txtAdd.getText().toString()};
  m.setTo(toArr); 
  m.setFrom("abc@gmail.com"); 
  m.setSubject("XXXXXXXXX"); 
  m.setBody("XXXXXXXXXXXXXX"); 
  try { 
    m.addAttachment(folder+"/abc.csv"); 
      if(m.send()) {
          result= true;
    } else { 
        result= false;
    } 
  } catch(Exception e) { 
   Log.e("MailApp", "Could not send email", e); 
  } 
  return result;
</code></pre>

<p>}</p>

<p>How to set the file name in attachment. </p>
