Android Gmail App fails to attach my CSV file
The following code works when I attach my csv file to the default email application on android, but does not work when I attach that same file to the gmail application. Does anyone have a solution for the gmail problem?
Resources res = getResources();
FileOutputStream outPut;
try {
outPut = getApplicationContext().openFileOutput("IPAddressPlanner.csv", Context.MODE_WORLD_READABLE);
SendMail.createCSVAttachment(outPut, res, values_subnet, values_mask, values_inverse, values_subnet_size, values_host_range, values_broadcast);
File F = getApplicationContext().getFileStreamPath("IPAddressPlanner.csv");
Uri U = Uri.fromFile(F);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822"); // use from live device
i.putExtra(Intent.EXTRA_SUBJECT, "IPV4 Address Information");
i.put开发者_如何学编程Extra(Intent.EXTRA_STREAM, U);
startActivity(Intent.createChooser(i,"Select email application."));
} catch (FileNotFoundException e) {
Log.e(TAG, e.getMessage());
}
精彩评论