I am sending a file in email file. The file sent but its size remains 0kb and file looses all data. Is there any way to do the same and file remains with is original contents? I am using following code.
File f=new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/SMSZip/a1.rar");
Uri uri = Uri.fromFile(f);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"abc77@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse(f.getAbsolutePath()));
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getApplicationContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}