我正在尝试将图像发送到 whatsapp,但出现 Toast 并说不支持文件格式

I am trying to send a image to whatsapp but it Toast appears and says The file formate is not supported

我正在尝试将图像分享到 whatsapp 或其他应用程序。图片位于 android studio 的可绘制文件夹中。但是当我尝试这样做时,它 Toasts 不支持文件格式。下面是我的代码。请帮忙提前谢谢

 public void share(View view)
{
    Uri uri=Uri.parse("android.resource://com.faisal.home.myapplication/drawable/"+R.drawable.tease);
    Intent intent,chooser;
    intent=new Intent(Intent.ACTION_SEND);
    intent.setType("image/*");
    intent.putExtra(Intent.EXTRA_STREAM,uri);
    chooser=Intent.createChooser(intent,"share Image");
    if(intent.resolveActivity(getPackageManager())!=null)
    {
        startActivity(chooser);

    }
    else
    {

        Toast.makeText(this,"No app to share",Toast.LENGTH_LONG).show();
    }


}
Try below mention code its working fine:

 try {
                    Uri imageUri = null;
                    try {
                        imageUri = Uri.parse(MediaStore.Images.Media.insertImage(Activity.getContentResolver(),
                                BitmapFactory.decodeResource(getResources(), R.drawable.yourimage), null, null));
                    } catch (NullPointerException e) {
                    }

                    Intent shareIntent = new Intent(Intent.ACTION_SEND);
                    shareIntent.setType("*/*");
                    shareIntent.putExtra(Intent.EXTRA_TEXT, "your text");

                    shareIntent.putExtra(Intent.EXTRA_STREAM,imageUri);

                    startActivity(shareIntent);
                } catch (android.content.ActivityNotFoundException ex) {
                    Toast.makeText(Activity, "no app fount", Toast.LENGTH_LONG).show();
                }