首页 > 解决方案 > 通过 Intent 共享文本在 Whatsapp 上被截断

问题描述

我通过意图共享一些文本,以便用户可以发送到他们选择的任何生成的应用程序createChooser 但是,我意识到当文本大小很大(1000 个字符或更多)时,Whatsapp 接收到的文本会被截断,但是接收到全文在电子邮件和其他应用程序上。我发现的唯一解决方案只允许仅发送到whatsApp Intent.ACTION_VIEW

Uri uriUrl = Uri.parse("whatsapp://send?text="+text+""); 
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);  
startActivity(launchBrowser);

那不是我想要的,因为我仍然希望生成应用程序的选择。我该怎么办?

   Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra("Intent.EXTRA_TEXT, "TEXT");
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, "SUBJECT");
        startActivity(Intent.createChooser(shareIntent, "Share..."));

标签: android-intentshare

解决方案


推荐阅读