是否可以共享文件(zip)和文本?
我尝试过,但是只能共享一个zip文件。我使用了ACTION_SEND_MULTIPLE和ACTION_SEND,但仍然只共享同一文件
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND_MULTIPLE);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, "Text ...");
share.putExtra(Intent.EXTRA_SUBJECT, "text ....");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(share, "share"));
答案 0 :(得分:0)
我通过与文本共享文件和图片解决了
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND_MULTIPLE);
share.setType("*/*");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
ArrayList<Uri> files = new ArrayList<Uri>();
files.add(ShareImage);
files.add(uri);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);
share.putExtra(Intent.EXTRA_TEXT, "Text ...");
share.putExtra(Intent.EXTRA_SUBJECT, "text ....");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(share, "share"));