分享意图whatsapp

时间:2018-03-26 05:12:33

标签: android android-intent whatsapp

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Mass Venture");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Download the Mass Venture Mobile Application to grab products with more offers. Use REFERENCE CODE:" + user_name);
shareIntent.setType("*/*");
startActivity(Intent.createChooser(shareIntent, "Refer & Earn"));

在选择whatsapp时显示,共享失败。我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

试试这个:

String shareText = "Enter the dummy text to share";
        Intent intent_share = new Intent();
        intent_share.setAction(Intent.ACTION_SEND);
        intent_share.putExtra(Intent.EXTRA_TEXT, shareText);
        intent_share.setType("text/plain");
        Intent.createChooser(intent_share, "Share via");
        startActivity(intent_share);

答案 1 :(得分:0)

                    Intent share = new Intent(android.content.Intent.ACTION_SEND);
                    share.setType("text/plain");
                    share.addFlags(Intent.FILL_IN_CATEGORIES);

                    share.putExtra(Intent.EXTRA_CC, "Title Here");

                    String message = " Your message text"


                    share.putExtra(Intent.EXTRA_TEXT, message);

                    startActivity(Intent.createChooser(share, "Share With"));