在一个应用程序中,我编写了一个方法,我使用它来使用whatsapp共享打印屏幕。 在开始分享whatsapp的意图并且我看到whatsapp屏幕后,当我尝试回到我的应用程序时(例如使用后退按钮),活动屏幕是黑色的(虽然我可以点击屏幕上的按钮甚至听到点击的声音。)
知道是什么原因引起的吗?
这就是我开始分享意图的方式:
public void SendWhatsappMessageWithImage(Context context, int type,
Uri imageUri) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
// Target whatsapp:
shareIntent.setPackage("com.whatsapp");
// Add text and then Image URI
if (type == 3) {
shareIntent.putExtra(Intent.EXTRA_TEXT, "some text for sharing");
}
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/png");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
context.startActivity(shareIntent);
} catch (android.content.ActivityNotFoundException ex) {
ToastHelper.MakeShortText("Whatsapp have not been installed.");
}
}