【发布时间】:2018-05-07 04:03:52
【问题描述】:
我正在使用图像和文本通过意图在 whatsapp 和其他电子邮件和短信中分享。
但是whatsapp 的问题是,图像正在显示,文本也显示,但 url 没有显示为链接。它显示为普通文本。可以看到如下代码。
Uri imageUri = Uri.parse(photoFile.getAbsolutePath()); //getting image
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
//Target whatsapp:
shareIntent.setPackage("com.whatsapp");
//Add text and then Image URI
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "Sharing the details.\n\n" +
"QR Code:" + QRCode + "\n" +
"Nama Retailer:" + retailerName + "\n" +
"Nama Owner:" + ownerName + "\n" +
"Nomer TRX:" + normorTrx + "\n" +
"Disclaimer" + "\n" +
"Please use the below link" + " "+
"http://116.12.2/images/disclaimer/NG20_SaTria_TC_Legal_050418_DISCLAIMER.pdf" +" "+
"for further information."
);
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
if (shareIntent.resolveActivity(getPackageManager()) != null) {
startActivity(shareIntent);
} else {
Toast.makeText(RetailerQRCodeGenerationActivity.this, "not available", Toast.LENGTH_SHORT).show();
}
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(RetailerQRCodeGenerationActivity.this, "Application not available.", Toast.LENGTH_SHORT).show();
}
【问题讨论】:
-
我可以知道为什么它被否决了吗?
标签: android android-intent android-pendingintent