這是我的代碼,但這是針對單個文件的解決方案。如何通過意圖共享多個文件?
我可以共享多個文件嗎&像我爲單個文件一樣上傳?
Button btn = (Button)findViewById(R.id.hello);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/pic.png";
File file = new File(path);
MimeTypeMap type = MimeTypeMap.getSingleton();
intent.setType(type.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(path)));
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.putExtra(Intent.EXTRA_TEXT, "1111");
startActivity(intent);
}
});
不幸的是,這似乎同時在Facebook上分享多張圖片不能正常工作。我能夠使用本文中描述的解決方案使其工作:http://stackoverflow.com/questions/25846496/intent-share-action-send-multiple-facebook-not-working – Lisitso 2015-01-16 10:41:40
ACTION_SEND_MULTIPLE'做了竅門: )tq – Prabs 2015-09-08 06:44:40
發送不同的文件類型image/*和video/*怎麼辦? – Eftekhari 2016-07-05 20:07:44