如何创建一个每次点击都会给你建议的 Intent

How to create an Intent that gives you suggestion every time you click

我正在开发一个应用程序,只要用户点击分享按钮,我就会使用分享按钮,建议 window 将像 Messenger、WhatsApp、蓝牙等一样打开。

但是当我从建议中选择时,下次我点击分享按钮时,它没有提供任何建议,而是将我带到我上次从建议中选择的应用程序,我也清除了应用程序缓存和应用程序数据,但是不起作用,请将我引导至我上次从建议中选择的应用程序。

分享按钮代码:

  Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
                whatsappIntent.setType("text/plain");
                whatsappIntent.putExtra(Intent.EXTRA_TEXT, UserStatusforshare);
                whatsappIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                whatsappIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

                try {
                    context.startActivity(whatsappIntent);
                } catch (android.content.ActivityNotFoundException ex) {

                    Toast.makeText(context, "Whatsapp have not been installed.", Toast.LENGTH_SHORT).show();
                }

备用代码我有:

Uri imgUri = Uri.parse(postImage);
            Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
            whatsappIntent.setType("text/plain");
            whatsappIntent.putExtra(Intent.EXTRA_TEXT, postDescription);
            whatsappIntent.putExtra(Intent.EXTRA_STREAM, imgUri);
            whatsappIntent.setType("image/jpeg");
            whatsappIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            whatsappIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

            try {
                context.startActivity(whatsappIntent);
            } catch (android.content.ActivityNotFoundException ex) {

                Toast.makeText(context, "No supported app exists!", Toast.LENGTH_SHORT).show();
            }

在此代码中,这里有一个图像,我也分享了一个图像...但是那个以相同方式工作的图像不会在每次单击时都提供建议,将我引导至我从中选择的应用程序最后的建议。

我尝试了 Whosebug 的一些答案,但我无法理解,我的搜索也不是很好...请帮助我是 android 的新手,谢谢 Adnvance

请尝试使用此代码开始意图:

       startActivity(Intent.createChooser(whatsappIntent, "The title what you want to show"));