我想分享图像和文字,如:
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri u = Uri.parse(url);
i.setData(u);
startActivity(intent);
答案 0 :(得分:0)
请找到以下代码。
Uri path= Uri.parse("android.resource://" + this.getPackageName()
+ "/drawable/" + "image_name");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, "Testing");
shareIntent.putExtra(Intent.EXTRA_STREAM, path);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "Share Using"));