将文件作为附件添加到 gmail
Adding a file as an attachment to gmail
当我将文件作为附件添加到 gmail 时,我看不到我的文件,只有消息 "one of the file has size more than 20mb",但我检查了一下,我必须添加文件 json 和图像,json 有尺寸小于 1kb,图像尺寸小于 600kB。
我检查过,但我没有机会压缩更多文件,也看不出我需要这样做的原因。
Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sharingIntent.setType("vnd.android.cursor.dir/email");
Uri jsonPath = Uri.fromFile(json);
Uri screenshotPath = Uri.fromFile(image);
ArrayList<Uri> uris = new ArrayList<>();
uris.add(json);
uris.add(image);
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
sharingIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Please entry the subject");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Please entry the content of email");
startActivity(Intent.createChooser(sharingIntent, "Choose direct application"));
我想包含这些文件:)
好的,我保证。
fileIn.setReadable(真,假)
当我将文件作为附件添加到 gmail 时,我看不到我的文件,只有消息 "one of the file has size more than 20mb",但我检查了一下,我必须添加文件 json 和图像,json 有尺寸小于 1kb,图像尺寸小于 600kB。
我检查过,但我没有机会压缩更多文件,也看不出我需要这样做的原因。
Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sharingIntent.setType("vnd.android.cursor.dir/email");
Uri jsonPath = Uri.fromFile(json);
Uri screenshotPath = Uri.fromFile(image);
ArrayList<Uri> uris = new ArrayList<>();
uris.add(json);
uris.add(image);
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
sharingIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Please entry the subject");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Please entry the content of email");
startActivity(Intent.createChooser(sharingIntent, "Choose direct application"));
我想包含这些文件:)
好的,我保证。
fileIn.setReadable(真,假)