我有一个收集用户数据的应用程序,并将它们显示在列表视图中。我还有一个具有以下功能的EmailSender类;
protected void sendEmail() {
Log.i("Send email", "");
String[] TO = {"amrood.admin@gmail.com"};
String[] CC = {"mcmohd@gmail.com"};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email...", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
}
我想自动将sqlite数据作为附件添加到电子邮件中。有什么想法?
答案 0 :(得分:1)
您可以像这样添加sqlite路径
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse(sqllitePath));
sqlite路径应该像
一样构建sqlitePath = "file://" + sqliteFolder.getAbsolutePath() + "/" + sqliteDbName;