I am sharing an image with text when I swipe right a RecyclerView item like below;
viewModel.shareUri.observe(viewLifecycleOwner,Observer{
val shareIntent = Intent(Intent.ACTION_SEND);
shareIntent.setType("image/png");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.putExtra(Intent.EXTRA_TEXT," "+requireContext().resources.getString(R.string.paylasimKitapAdText));
shareIntent.putExtra(Intent.EXTRA_STREAM, it);
startActivity(Intent.createChooser(shareIntent, view.context.resources.getString(R.string.shareLabel)));
adapter?.notifyItemChanged(position);
});
Share is opening and then I am canceling. After again when I share , chooser is multiplying? Is there any problem in this code?